Limit size of datagrid

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

not sure if I should post this in the web controls newsgroup but just
wondering if there is a way to limit the size of a datagrid and instead of
cutting dat off the user will have a scroll down bar as is done in some
windows applications.
thanks.
 
One way is to place the datagrid in a scrolling div.

<div style="OVERFLOW: auto; HEIGHT: 100px; WIDTH: 400px;">
<asp:DataGrid id="dgMyGrid" Width="380px" runat="server" CellPadding="0">
</asp:DataGrid>
</div>

Hope this helps,

Joel Cade, MCSD
Fig Tree Solutions, LLC
http://www.figtreesolutions.com
 
Hi Joel thanks for the information. This seems to be working as I have
<div style="OVERFLOW: auto; HEIGHT: 100px; WIDTH: 900px; POSITION: 100,200;">
datagrid
div end tag,
except that I am not able to position it, not sure if I am using the
POSITION correctly but it is currently at the top left section of the form.
Also the user has to scroll down just to see the grid but I think I can fix
this by reducing the HEIGHT of the scrolling div.
Thanks Paul.
 
Paul said:
not sure if I should post this in the web controls newsgroup but just
wondering if there is a way to limit the size of a datagrid and instead of
cutting dat off the user will have a scroll down bar as is done in some
windows applications.

In addition to Joel's solution, you might want to also check out this FAQ:
http://datawebcontrols.com/faqs/CustomizingAppearance/ScrollableDataGridWithFixedHeader.shtml

It shows how to create a scrollable DataGrid with fixed headers.

Happy Programming!

--

Scott Mitchell
(e-mail address removed)
http://www.4GuysFromRolla.com

* When you think ASP.NET, think 4GuysFromRolla.com!
 
ok thanks, ended up using the following, with a border around it.
<div style="BORDER-RIGHT: navy 2px solid; PADDING-RIGHT: 1px; BORDER-TOP:
navy 2px solid; PADDING-LEFT: 1px; LEFT: 0px; PADDING-BOTTOM: 1px; OVERFLOW:
auto; BORDER-LEFT: navy 2px solid; WIDTH: 850px; PADDING-TOP: 1px;
BORDER-BOTTOM: navy 2px solid; POSITION: relative; TOP: 204px; HEIGHT: 110px">
 
Back
Top