Home All Groups Group Topic Archive Search About

DataGrid Row Auto-Size

Author
11 Apr 2005 2:25 PM
Bruce Pullum
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

Author
27 Apr 2005 3:04 PM
Mark Newby
Bruce Pullum wrote:
> 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
Are all your drivers up to date? click for free checkup

Author
19 Jul 2005 10:18 AM
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

Show quoteHide quote
"Mark Newby" <m***@newby.plus.com> wrote in message
news:426FAA12.7060907@newby.plus.com...
> Bruce Pullum wrote:
>> 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

Bookmark and Share