471,337 Members | 1,109 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

DataGrid display

Hi,

Can a datagrid display be split into 2 rows.
for e.g: suppose my resultset has 20 columns and I want to display 10 in the
first row and and rest in another so that the display is not kludgy.
is it possible?

Thanks,
Stephen
Nov 20 '05 #1
2 1154
Each DatagridItem renders a separate table row, within that DataGridItem you
might create an ItemTemplate for each column that contains a table of two
rows (one for each column in your datatable) .
<ItemTemplate >
<table >
<!--- this row would display col1--->
<tr>
<td >
<asp:Label ID="lblCompanyName" Runat=server Text='<%#
DataBinder.Eval(Container.DataItem, "Col1")%>'></asp:Label>
</td>
</tr>
<!--- this row would display col8 (assuming there 14 columns in the table,
the first 7 would be in the first row -->
<tr >
<td>
<asp:Label ID="lblCompanyName" Runat=server Text='<%#
DataBinder.Eval(Container.DataItem, "Col8")%>'></asp:Label>
</td>
</tr>
</table>
</ItemTemplate>
Though, you might want to consider a DataList instead, where each item is a
tablecell. This gives you more freedom to create a template that contains an
HTMLTable with two rows. Or a repeater.

--
[note: if this post answers your question, you can mark it as an answer
using the web-based newsreader functions]
-----
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Stephen" wrote:
Hi,

Can a datagrid display be split into 2 rows.
for e.g: suppose my resultset has 20 columns and I want to display 10 in the
first row and and rest in another so that the display is not kludgy.
is it possible?

Thanks,
Stephen

Nov 20 '05 #2
Thanks Phillip,

"Phillip Williams" <Ph**************@webswapp.com> wrote in message
news:91**********************************@microsof t.com...
Each DatagridItem renders a separate table row, within that DataGridItem you might create an ItemTemplate for each column that contains a table of two
rows (one for each column in your datatable) .
<ItemTemplate >
<table >
<!--- this row would display col1--->
<tr>
<td >
<asp:Label ID="lblCompanyName" Runat=server Text='<%#
DataBinder.Eval(Container.DataItem, "Col1")%>'></asp:Label>
</td>
</tr>
<!--- this row would display col8 (assuming there 14 columns in the table,
the first 7 would be in the first row -->
<tr >
<td>
<asp:Label ID="lblCompanyName" Runat=server Text='<%#
DataBinder.Eval(Container.DataItem, "Col8")%>'></asp:Label>
</td>
</tr>
</table>
</ItemTemplate>
Though, you might want to consider a DataList instead, where each item is a tablecell. This gives you more freedom to create a template that contains an HTMLTable with two rows. Or a repeater.

--
[note: if this post answers your question, you can mark it as an answer
using the web-based newsreader functions]
-----
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Stephen" wrote:
Hi,

Can a datagrid display be split into 2 rows.
for e.g: suppose my resultset has 20 columns and I want to display 10 in the first row and and rest in another so that the display is not kludgy.
is it possible?

Thanks,
Stephen

Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Joe Bloggs | last post: by
3 posts views Thread by Andrew S. Giles | last post: by
3 posts views Thread by Doug | last post: by
7 posts views Thread by CanoeGuy | last post: by
7 posts views Thread by julian.tklim | last post: by
5 posts views Thread by rn5a | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.