Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DataGrid Control Customization 1

Status
Not open for further replies.

thedman00

Programmer
Jun 11, 2003
46
AT
I'm wondering how you put a line break between the columns of your datagrid. The goal is to display some fields (columns) on one line and others on the next line due to the length of some of the fields (columns) An example output is below.


ID FNAME LNAME
1 Billy Bob

DESCRIPTION
This is a description

Rather than having the description directly following the LNAME.
Thanks
 
In your datagrid, try using a single TemplateColumn like this:

<asp:TemplateColumn>
<ItemTemplate>
<table border=0 cellpadding=2 cellspacing=0 width=100%>
<tr>
<td><%# DataBinder.Eval ( Container.DataItem, &quot;ID&quot; ) %></td>
<td><%# DataBinder.Eval ( Container.DataItem, &quot;FNAME&quot; ) %></td>
<td><%# DataBinder.Eval ( Container.DataItem, &quot;LNAME&quot; ) %></td>
</tr>
<tr>
<td colspan=3><%# DataBinder.Eval ( Container.DataItem, &quot;DESCRIPTION&quot; %></td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateColumn>

As far as I know, there is no built-in method of adding a second row based on the same record to a datagrid. What this does is creates one cell in the datagrid, and then populates that cell with a table with the needed formatting.

-Hope this helps :)

-----------------------------------------------
&quot;The night sky over the planet Krikkit is the least interesting sight in the entire universe.&quot;
-Hitch Hiker's Guide To The Galaxy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top