DataGrid Row Auto-Size

G

Guest

Can Someone please help me get the DATAGRID to keep the row size consistent
when there is 1 row or 50 rows. Right now, if the datagrid has several rows
of data, it is ok, and looks like a normal data grid. However, if the data
goes to 1, 2, 3, etc rows of data, the grid will try to AUTO-SIZE the data
row size, making the few rows of data take up the entire grid size.... This
make the end result look really bad....

Please help with you ideas... I have searched everywhere for a solution to
this...

Thanks,
Bruce
 
M

Mark Newby

Bruce said:
Can Someone please help me get the DATAGRID to keep the row size consistent
when there is 1 row or 50 rows. Right now, if the datagrid has several rows
of data, it is ok, and looks like a normal data grid. However, if the data
goes to 1, 2, 3, etc rows of data, the grid will try to AUTO-SIZE the data
row size, making the few rows of data take up the entire grid size.... This
make the end result look really bad....

Please help with you ideas... I have searched everywhere for a solution to
this...

Thanks,
Bruce

I've not tested this out, but try reducing the vertical length of the
datagrid in design view. if there's a couple of inches in design view,
it seems to try and fill to this size even if there's only 1-2 rows --as
if it's using the design-view's size as a minimum size. so try reducing
this minimum size.


mark
 
T

TC

You have to assign the width of every datagrid cell in the .aspx file. In
Vis Studio this is within the html view. Using a templated column it's liek
this:

<asp:TemplateColumn HeaderText="Name">
<ItemTemplate>
<asp:Label id="Name" width=60 runat="server" Text='<%#
DataBinder.Eval(Container, "DataItem.Name") %>'>
</asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox id="NameEdit" width=130 runat="server" Text='<%#
DataBinder.Eval(Container, "DataItem.Name") %>'>
</asp:TextBox>
</EditItemTemplate>
</asp:TemplateColumn>

TC
 

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,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top