1 Attachment(s)
[RESOLVED] asp:Gridview ItemStyle-Width Problem ???
Hi guys !
I dont know why, whatever I put in the ItemStyle-Width value (8px), the columns width seems to not follow this value ??? As per the attached printscreen, the columns supposed to be identical, but is not...
For information, the headers are off, I made it with a asp:Table...
Is someone could help me ? Thanks in advance !
Code:
<asp:GridView ID="GridViewCalc" CssClass="GridViewCalc" runat="server" AutoGenerateColumns="False" DataSourceID="AccessDataSource2" EmptyDataText="Aucune donnée man" ShowHeader="False" CellPadding="0">
<columns>
<asp:BoundField DataField="Champ1" SortExpression="Champ1" ItemStyle-Width="8px" ItemStyle-HorizontalAlign="Center"></asp:BoundField>
<asp:BoundField DataField="Champ2" ItemStyle-Width="8px" ItemStyle-HorizontalAlign="Center"></asp:BoundField>
<asp:BoundField DataField="Champ3" ItemStyle-Width="8px" ItemStyle-HorizontalAlign="Center"></asp:BoundField>
<asp:BoundField DataField="Champ4" ItemStyle-Width="8px" ItemStyle-HorizontalAlign="Center"></asp:BoundField>
<asp:BoundField DataField="Champ5" ItemStyle-Width="8px" ItemStyle-HorizontalAlign="Center"></asp:BoundField>
<asp:BoundField DataField="Champ6" ItemStyle-Width="8px" ItemStyle-HorizontalAlign="Center"></asp:BoundField>
<asp:BoundField DataField="Champ7" ItemStyle-Width="8px" ItemStyle-HorizontalAlign="Center"></asp:BoundField>
</columns>
</asp:GridView>
Code:
.GridViewCalc {position:absolute; top:0px; left:0px; width:470px; height:175px;background:#FFFFFF; color:#3B4E77;}
Re: asp:Gridview ItemStyle-Width Problem ???
Hello there,
First question, why have you created the header separately with another table? Why not let the GridView include the header row for you?
Secondly, why 8px? That really isn't wide enough for what you have in the columns?!?
Have you checked the markup/style/CSS that is rendered to the page? It should be clear from there what is going on.
Also, can you show what is defined within GridViewCalc?
Gary
Re: asp:Gridview ItemStyle-Width Problem ???
Quote:
Originally Posted by
gep13
First question, why have you created the header separately with another table? Why not let the GridView include the header row for you?
Because Im very new to asp.net and this is the easy solution I found, I had problems with the headers (scroll)
Quote:
Originally Posted by
gep13
Secondly, why 8px? That really isn't wide enough for what you have in the columns?!?
It's only as test...to show you that the result is not ok (printscreen)
Quote:
Originally Posted by
gep13
Have you checked the markup/style/CSS that is rendered to the page? It should be clear from there what is going on.
As I said, Im very new to this and I dont know what you're taking about, sorry...
Quote:
Originally Posted by
gep13
Also, can you show what is defined within GridViewCalc?
In the CSS Style ??? It's in the first thread...
Thanks !
1 Attachment(s)
Re: asp:Gridview ItemStyle-Width Problem ???
I removed the CssClass="GridViewCalc" and the columns width seems to be ok, but I dont know what is wrong in my css style ???
After searching few minutes...Finally I found that the width:470px in my Css Style is to wide...
Thanks in advance !
Re: asp:Gridview ItemStyle-Width Problem ???
Hi Gary !
Even if my problem is resolved...
I would like to know your suggestion about my header and I would like to understand the "....markup/style/CSS that is rendered to the page?"...I want to learn !!!
Thanks !
Re: asp:Gridview ItemStyle-Width Problem ???
Hello,
Sorry for not replying sooner, I have been away at a conference.
Apologies about not seeing the definition of GridViewCalc, I must have missed that in your first post.
What I was referring to when I said:
Quote:
Have you checked the markup/style/CSS that is rendered to the page? It should be clear from there what is going on.
Was looking at the raw HTML that is rendered to the page. This is normally visible by right clicking on the page in the browser and selecting "View Source". This allows you to inspect the rendered HTML, and see what the ASP.Net page actually spits out. If you then add on top of this tools such as the excellent FireBug (which is available in both FireFox and Chrome) you can start tinkering with the HTML elements to try to figure out why things aren't exactly working. This involves changing CSS statements on the fly, as well as HTML attributes, etc.
The best way to learn about this is by doing it. Have a look here:
http://getfirebug.com/wiki/index.php/FAQ
As for learning CSS, there are literally a ton of resources out there, I would start by having a look here:
http://htmldog.com/
Gary
Re: asp:Gridview ItemStyle-Width Problem ???
Re: [RESOLVED] asp:Gridview ItemStyle-Width Problem ???
Not a problem at all, let me know if you have any follow up questions.
Gary