Results 1 to 8 of 8

Thread: [RESOLVED] asp:Gridview ItemStyle-Width Problem ???

  1. #1

    Thread Starter
    Hyperactive Member DubweiserTM's Avatar
    Join Date
    Dec 2005
    Location
    St-Ferdinand, Québec
    Posts
    427

    Resolved [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;}
    Attached Images Attached Images  
    DubweiserTM

    If your question has been answered, you can mark a thread as resolved...

  2. #2
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    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

  3. #3

    Thread Starter
    Hyperactive Member DubweiserTM's Avatar
    Join Date
    Dec 2005
    Location
    St-Ferdinand, Québec
    Posts
    427

    Re: asp:Gridview ItemStyle-Width Problem ???

    Quote Originally Posted by gep13 View Post
    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 View Post
    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 View Post
    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 View Post
    Also, can you show what is defined within GridViewCalc?
    In the CSS Style ??? It's in the first thread...

    Thanks !
    DubweiserTM

    If your question has been answered, you can mark a thread as resolved...

  4. #4

    Thread Starter
    Hyperactive Member DubweiserTM's Avatar
    Join Date
    Dec 2005
    Location
    St-Ferdinand, Québec
    Posts
    427

    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 !
    Attached Images Attached Images  
    Last edited by DubweiserTM; Apr 11th, 2011 at 11:54 AM.
    DubweiserTM

    If your question has been answered, you can mark a thread as resolved...

  5. #5

    Thread Starter
    Hyperactive Member DubweiserTM's Avatar
    Join Date
    Dec 2005
    Location
    St-Ferdinand, Québec
    Posts
    427

    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 !
    DubweiserTM

    If your question has been answered, you can mark a thread as resolved...

  6. #6
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    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:

    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

  7. #7

    Thread Starter
    Hyperactive Member DubweiserTM's Avatar
    Join Date
    Dec 2005
    Location
    St-Ferdinand, Québec
    Posts
    427

    Re: asp:Gridview ItemStyle-Width Problem ???

    Thanks for your help !
    DubweiserTM

    If your question has been answered, you can mark a thread as resolved...

  8. #8
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: [RESOLVED] asp:Gridview ItemStyle-Width Problem ???

    Not a problem at all, let me know if you have any follow up questions.

    Gary

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width