473,413 Members | 2,066 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

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 1403
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Gav | last post by:
Hi All, I have created a datalist using the repeatcolumns property to create multiple columns. I have tried to keep everythings width to 100% so that if the window is resized it still looks...
6
by: Thanh | last post by:
I created an ASP.NET project and dropped a DataList on the web form. I then wrote a simple class to return data: namespace Playing { public class PositionData { private string name; private...
0
by: Shun Duke | last post by:
I have working code allowing me to nest repeaters inside datalists using relations and child rows but this does not allow me to acheive my goal. What I want to be able to do is display small...
5
by: Ben Fidge | last post by:
I'm using DataList to present tabular data but am often having problems with some rows column alignment being out of synch with the rest of the rows. My DataList looks similar to this...: ...
2
by: Stimp | last post by:
I would like to produce something like: http://redwoodestates.co.uk/forrent.aspx It's either a datalist/repeater/datagrid, but it is broken up into sections ("1 bedroom", "2 bedroom", etc...)...
2
by: serge calderara | last post by:
Dear all, I have make some basic testing on Repeater and DataList object. I have notice for sure that if your database retrive data contains 3 records, then both controls will repeat the...
1
by: Simon Cheng | last post by:
When I tried to display data in datalist and repeater, the first data item always disappears in all datalist and repeaters in my web forms. The code I use for the html page is: <TD...
3
by: rn5a | last post by:
I want to change the background color of a row in a DataList when the mouse is moved over a row. This is how I tried but it doesn't change the background color of a row in the DataList when the...
2
by: Paulo | last post by:
What is DetailsView, FormView, DataList, Repeater components? Any differences? VS 2005 asp.net C#
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.