473,574 Members | 10,225 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_OnI temDataBound">
<ItemTemplate >
<table>
<tr>
<td colspan="2"><%# DataBinder.Eval (Container.Data Item,
"ChapterName")% ></td>
</tr>
<tr
<td>Updated</td>
<td>Document Title</td>
</tr>
<asp:Repeater ID="rptDocument " Runat="server">
<ItemTemplate >
<tr>
<td><%#
((DataRow)Conta iner.DataItem)["LastUpdatedOn_ Formatted"]%></td>
<td><%# ((DataRow)Conta iner.DataItem)["DocumentTi tle"]%></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="F low" 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 1413
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**********@g mail.com> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.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_OnI temDataBound">
<ItemTemplate >
<table>
<tr>
<td colspan="2"><%# DataBinder.Eval (Container.Data Item,
"ChapterName")% ></td>
</tr>
<tr
<td>Updated</td>
<td>Document Title</td>
</tr>
<asp:Repeater ID="rptDocument " Runat="server">
<ItemTemplate >
<tr>
<td><%#
((DataRow)Conta iner.DataItem)["LastUpdatedOn_ Formatted"]%></td>
<td><%# ((DataRow)Conta iner.DataItem)["DocumentTi tle"]%></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="F low" 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_ItemC reated(ByVal sender As Object, _
ByVal e As System.Web.UI.W ebControls.Data GridItemEventAr gs) _
Handles DataGrid1.ItemC reated
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
7649
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 alright. However with these repeating columns it throws everything out of align because it lets you scroll horizontally but everything else on the page...
6
1320
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 string ticker;
0
1168
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 tables (approx 5-10 rows by 3-4 columns) of data using repeaters nested in a datalist. Each row in the datalist source will act as a pointer and...
5
3758
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...: <asp:datalist id="DataList1" runat="server"> <HeaderTemplate> <table border="0" cellpadding="0" cellspacing="0" width="400"> <tr> <td...
2
1144
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...) My experience with datalists is that you can have a <SeparatorTemplate> between each row, but how do they manage to separate rows at random...
2
1188
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 predifined template to display those 3 records. As a first view I would say that Datalist or Repeater are not so suitable as Datagrid to display a well...
1
1737
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 id="tdDepartment" runat="server"><asp:datalist id="dlstDept" runat="server" HorizontalAlign="Left" CellPadding="0" Width="100%"> <HeaderTemplate>...
3
8881
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 mouse is moved over a row: <script runat="server"> Sub CreateItem(ByVal obj As Object, ByVal ea As DataListItemEventArgs) If (ea.Item.ItemType =...
2
11830
by: Paulo | last post by:
What is DetailsView, FormView, DataList, Repeater components? Any differences? VS 2005 asp.net C#
0
7739
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7835
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8121
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5635
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5326
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3761
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3777
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1360
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1087
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.