468,291 Members | 1,485 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,291 developers. It's quick & easy.

DataList containing a Repeater

GD
I'm using a DataList and a Repeater (nested in the DataList) to display
a list of "Chapters" and "Documents" within the Chapters.

<asp:DataList ID="dlChapter" Runat="server" RepeatColumns="2"
RepeatDirection="Vertical" OnItemDataBound="dlChapter_OnItemDataBound">
<ItemTemplate>
<table>
<tr>
<td colspan="2"><%# DataBinder.Eval(Container.DataItem,
"ChapterName")%></td>
</tr>
<tr
<td>Updated</td>
<td>Document Title</td>
</tr>
<asp:Repeater ID="rptDocument" Runat="server">
<ItemTemplate>
<tr>
<td><%#
((DataRow)Container.DataItem)["LastUpdatedOn_Formatted"]%></td>
<td><%# ((DataRow)Container.DataItem)["DocumentTitle"]%></td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
</ItemTemplate>
</asp:DataList>

I'm using the DataList's OnItemDataBound to populate the Repeater with
the current DataRow's ChildRows. Works like a charm.

However, I'm having some display issues ... Because the RepeatColumns
property is set to two, the resulting HTML is a Table with two <td>'s
in each <tr>. However, the height of the content in each <td> isn't
necessarily the same as that of the content in the other <td> in that
<tr>

It seems as if RepeatLayout="Flow" would solve this problem, but
setting that seems to cause the DataList to ignore the
RepeatColumns="2" when rendering the HTML.

I scoured the groups for a solution to this :) Would appreciate any
tips!

Thanks!

Feb 22 '06 #1
3 1252
Have tried getting to cells and assigning them UNITS
Not sure of Datalist but sure i did that once with DataGrid
Hope that helps
Patrick
"GD" <ge**********@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I'm using a DataList and a Repeater (nested in the DataList) to display
a list of "Chapters" and "Documents" within the Chapters.

<asp:DataList ID="dlChapter" Runat="server" RepeatColumns="2"
RepeatDirection="Vertical" OnItemDataBound="dlChapter_OnItemDataBound">
<ItemTemplate>
<table>
<tr>
<td colspan="2"><%# DataBinder.Eval(Container.DataItem,
"ChapterName")%></td>
</tr>
<tr
<td>Updated</td>
<td>Document Title</td>
</tr>
<asp:Repeater ID="rptDocument" Runat="server">
<ItemTemplate>
<tr>
<td><%#
((DataRow)Container.DataItem)["LastUpdatedOn_Formatted"]%></td>
<td><%# ((DataRow)Container.DataItem)["DocumentTitle"]%></td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
</ItemTemplate>
</asp:DataList>

I'm using the DataList's OnItemDataBound to populate the Repeater with
the current DataRow's ChildRows. Works like a charm.

However, I'm having some display issues ... Because the RepeatColumns
property is set to two, the resulting HTML is a Table with two <td>'s
in each <tr>. However, the height of the content in each <td> isn't
necessarily the same as that of the content in the other <td> in that
<tr>

It seems as if RepeatLayout="Flow" would solve this problem, but
setting that seems to cause the DataList to ignore the
RepeatColumns="2" when rendering the HTML.

I scoured the groups for a solution to this :) Would appreciate any
tips!

Thanks!

Feb 23 '06 #2
GD
Patrick,
Would you mind posting a small example? Much appreciated!

Feb 23 '06 #3
You can do it at runtime e.g
Private Sub DataGrid1_ItemCreated(ByVal sender As Object, _
ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) _
Handles DataGrid1.ItemCreated
e.Item.Cells(0).Width = New Unit(100)
e.Item.Cells(1).Width = New Unit(50)
End Sub

or using the style element (or the ItemStyle-Height property). in
design

Hope that helps
Patrick


*** Sent via Developersdex http://www.developersdex.com ***
Mar 10 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Gav | last post: by
6 posts views Thread by Thanh | last post: by
reply views Thread by Shun Duke | last post: by
5 posts views Thread by Ben Fidge | last post: by
2 posts views Thread by serge calderara | last post: by
3 posts views Thread by rn5a | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.