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)?
TIAI'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" <AndrewHayes@.discussions.microsoft.com> wrote in message
news:O4VrTWsDHHA.2356@.TK2MSFTNGP03.phx.gbl...
> 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
>
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
http://msdn.microsoft.com/workshop/...dth.a
sp
<Andrew Hayes> wrote in message
news:eTlbYOnGHHA.1248@.TK2MSFTNGP02.phx.gbl...
> 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
Wednesday, March 28, 2012
Setting Proportional Width of Bound GridView
Labels:
aobjectdatasource,
asp,
autogenerates,
binding,
bound,
control,
gridview,
net,
page,
proportional,
reading,
setting,
web,
width
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment