Groups | Blog | Home
all groups > asp.net webcontrols > june 2003 >

asp.net webcontrols : Vertical DataGrid


Ryan
6/26/2003 7:18:10 AM
Is there any way to make a datagrid display its data
vertically? I have a table with about 40 columns which I
would like to put in a grid of some sort for editing, but
in the standard datagrid, it stretches way beyond the
screen. I'd like to display the data, one record at a time
with the database columns listed vertically on the screen.
Is there an easy way to do this? A DataList perhaps?

N
6/27/2003 10:53:21 AM
Either a DataList or DataGrid would do..

Personally I prefer datagrids myself.
In DataGrid, then use the TemplateColumn... just specify the proper bindings
in the ItemTemplate & EditTemplate sections of the grid.
A quick example would be as follows...

<asp:datagrid id=dgSearchResult runat="server">
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
CustomerNum: <b><%# DataBinder.Eval(Container.DataItem,
"customerNum")%>)</b><br>
</ItemTemplate>

<EditItemTemplate>
<asp:TextBox runat="server" Text='<%#
DataBinder.Eval(Container.DataItem, "customerNum") %>'>
</asp:TextBox>
</EditItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>

So, you could have a nested table in the ItemTemplate & EditItemTemplate
sections...

Regards,
Noel Hoo
noelh@imaNgOe-ScPeAnMtre.com

[quoted text, click to view]

Ron McNulty
6/29/2003 3:02:14 AM
Best way is to use both. Display a few key fields in the
grid, and use a single-record DataList to show all the
fields for the selected record.

Regards

Ron

[quoted text, click to view]
AddThis Social Bookmark Button