Setting Proportional Width of Bound GridView

Discussion in 'ASP .Net' started by Andrew Hayes, Nov 23, 2006.

  1. Andrew Hayes

    Andrew Hayes Guest

    In a C#.NET web page, I'm using the GridView control bound to a
    ObjectDataSource and the binding and data reading works fine. It auto
    generates the columns from the SelectMethod and makes the drid wide enough
    to show them all.

    The problem comes when I have an asp:panel control around the grid (to
    generate scrollbars if the GridView is larger than the screen size).

    It always make the encompassing control as wide as the GridView.

    Now, I was under the assumption that if a Table element has a width of
    "100%", that applies to the browser size, not the size of the content of the
    table... Maybe that is my mistake.

    If I set the Panel width explicitly, it all works OK, but then when I resize
    the browser window, the panel doesn't resize (of course).

    Does anyone know of a simple way to size an asp:panel element so that it is
    sized to the browser size, while the contents of the panel retain their own
    fixed size (thereby forcing the creation of the scrollbars)?

    TIA
     
    Andrew Hayes, Nov 23, 2006
    #1
    1. Advertising

  2. Andrew Hayes

    Lukas Kurka Guest

    I'm afraid there is no way how to use proportional size (%) and scrollbars
    together:( I have tried a lot and i wasn't a bit succesfull so i have
    written javascript code which recalculate the size and set fixed width of
    panel

    Lukas

    "Andrew Hayes" <> wrote in message
    news:...
    > In a C#.NET web page, I'm using the GridView control bound to a
    > ObjectDataSource and the binding and data reading works fine. It auto
    > generates the columns from the SelectMethod and makes the drid wide enough
    > to show them all.
    >
    > The problem comes when I have an asp:panel control around the grid (to
    > generate scrollbars if the GridView is larger than the screen size).
    >
    > It always make the encompassing control as wide as the GridView.
    >
    > Now, I was under the assumption that if a Table element has a width of
    > "100%", that applies to the browser size, not the size of the content of
    > the table... Maybe that is my mistake.
    >
    > If I set the Panel width explicitly, it all works OK, but then when I
    > resize the browser window, the panel doesn't resize (of course).
    >
    > Does anyone know of a simple way to size an asp:panel element so that it
    > is sized to the browser size, while the contents of the panel retain their
    > own fixed size (thereby forcing the creation of the scrollbars)?
    >
    > TIA
    >
     
    Lukas Kurka, Nov 23, 2006
    #2
    1. Advertising

  3. Andrew Hayes

    Andrew Hayes Guest

    Being a C# developer, I know next to nothing about Javascript, so could you post the js code you used to determine what width to set the Panel to? TIA
     
    Andrew Hayes, Dec 8, 2006
    #3
  4. Andrew Hayes

    Lukas Kurka Guest

    Lukas Kurka, Dec 8, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tina

    non proportional fonts

    Tina, Dec 8, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    473
  2. Roedy Green
    Replies:
    0
    Views:
    533
    Roedy Green
    Jul 14, 2005
  3. Brian

    Table proportional widths?

    Brian, Feb 8, 2006, in forum: HTML
    Replies:
    2
    Views:
    1,568
    Brian
    Feb 9, 2006
  4. shajnday
    Replies:
    30
    Views:
    1,136
    Gus Richter
    Oct 21, 2011
  5. Replies:
    1
    Views:
    134
Loading...

Share This Page