Setting Proportional Width of Bound GridView

A

Andrew Hayes

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
 
L

Lukas Kurka

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
 
A

Andrew Hayes

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top