473,396 Members | 1,693 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,396 software developers and data experts.

Inner Repeater without dataset relationships... is it possible?

I have inner Repeater2 inside Repeater1.
Problem is that I can't show the data of Repeater2 properly

What is shown on Screen is:

Line_1 Of Repeater_2
Line_2 Of Repeater_2
Line_3 Of Repeater_2

Line_1 Of Repeater_1
Line_2 Of Repeater_1
Line_3 Of Repeater_1

It should be:

Line_1 Of Repeater_1
Line_1 Of Repeater_2
Line_2 Of Repeater_2
Line_3 Of Repeater_2
Line_2 Of Repeater_1
Line_1 Of Repeater_2
Line_2 Of Repeater_2
Line_3 Of Repeater_2
Line_3 Of Repeater_1
Line_1 Of Repeater_2
Line_2 Of Repeater_2
Line_3 Of Repeater_2

Apparently, a nested Repeater should have been set with Relationship in
Dataset. But I bind my Repeaters with Objects!
Is there any way to show data of repeaters properly?

My code:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then

Repeater1.DataSource = oMyObjectList1
Repeater1.DataBind()
End If
End Sub

Private Sub Repeater1_ItemDataBound(ByVal sender As System.Object,
ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles
Repeater1.ItemDataBound

Dim item As RepeaterItem = e.Item
If ((item.ItemType = ListItemType.Item) Or (item.ItemType =
ListItemType.AlternatingItem)) Then

Dim R2 As Repeater = CType(item.FindControl("Repeater2"),
Repeater)

'Dim drv As DataRowView = CType(item.DataItem, DataRowView)
R2.DataSource = oMyObjectList2
R2.DataBind()
End If
End Sub

<asp:Repeater id="Repeater1" runat="server">
<ItemTemplate>
<tr>
<td width="75%" align="right">
<%# DataBinder.Eval(Container.DataItem, "ApePat")%>
</td>
</tr>
<tr>
<td width="75%" align="right">
<%# DataBinder.Eval(Container.DataItem, "Property_1")%>
<br>
</td>
</tr>
<asp:Repeater id="Repeater2" runat="server">
<ItemTemplate>
<li>
<%# DataBinder.Eval(Container.DataItem, "Property_2")%>
</li>
</ItemTemplate>
</asp:Repeater>
</ItemTemplate>
</asp:Repeater>

Oct 13 '06 #1
1 1489


The key is to code up your down "GetChildren"

Here is a typical line

datasource='<%# ((DataRowView)Container.DataItem)
.Row.GetChildRows("myrelation") %>' >
.......

What I would try is this:

create a member variable
m_customers as CustomersCollection

I'm assuming that CustomersCollection has many Customer objects ('s) in it.

THEN: each Customer (object) has a child collection of Orders

Customer.Orders
When you set the .datasource property of the child repeater...... you call
your own method
Dim R2 As Repeater = CType(item.FindControl("Repeater2"),
Repeater)
dim cID as int32 = 0 '' pull the customerID from the outer
datasource
R2.DataSource = FindMyChildren ( )
R2.DataBind()
private sub FindMyChildren ( customerID as int32 ) as ''Some kind of
collectionbase object

return m_customers.Find(customerID).Orders

end sub

Does that make sense?

The key is that you need a member variable, housing all the info, and you
write you own little "GetChildren" method.

You can find some sample code at
http://sholliday.spaces.live.com/?_c...26ayear%3d2006
downloadable.
And find the "Find" or "Contains" method implementation

"Big Charles" <ch**********@yahoo.comwrote in message
news:11*********************@e3g2000cwe.googlegrou ps.com...
I have inner Repeater2 inside Repeater1.
Problem is that I can't show the data of Repeater2 properly

What is shown on Screen is:

Line_1 Of Repeater_2
Line_2 Of Repeater_2
Line_3 Of Repeater_2

Line_1 Of Repeater_1
Line_2 Of Repeater_1
Line_3 Of Repeater_1

It should be:

Line_1 Of Repeater_1
Line_1 Of Repeater_2
Line_2 Of Repeater_2
Line_3 Of Repeater_2
Line_2 Of Repeater_1
Line_1 Of Repeater_2
Line_2 Of Repeater_2
Line_3 Of Repeater_2
Line_3 Of Repeater_1
Line_1 Of Repeater_2
Line_2 Of Repeater_2
Line_3 Of Repeater_2

Apparently, a nested Repeater should have been set with Relationship in
Dataset. But I bind my Repeaters with Objects!
Is there any way to show data of repeaters properly?

My code:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then

Repeater1.DataSource = oMyObjectList1
Repeater1.DataBind()
End If
End Sub

Private Sub Repeater1_ItemDataBound(ByVal sender As System.Object,
ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles
Repeater1.ItemDataBound

Dim item As RepeaterItem = e.Item
If ((item.ItemType = ListItemType.Item) Or (item.ItemType =
ListItemType.AlternatingItem)) Then

Dim R2 As Repeater = CType(item.FindControl("Repeater2"),
Repeater)

'Dim drv As DataRowView = CType(item.DataItem, DataRowView)
R2.DataSource = oMyObjectList2
R2.DataBind()
End If
End Sub

<asp:Repeater id="Repeater1" runat="server">
<ItemTemplate>
<tr>
<td width="75%" align="right">
<%# DataBinder.Eval(Container.DataItem, "ApePat")%>
</td>
</tr>
<tr>
<td width="75%" align="right">
<%# DataBinder.Eval(Container.DataItem, "Property_1")%>
<br>
</td>
</tr>
<asp:Repeater id="Repeater2" runat="server">
<ItemTemplate>
<li>
<%# DataBinder.Eval(Container.DataItem, "Property_2")%>
</li>
</ItemTemplate>
</asp:Repeater>
</ItemTemplate>
</asp:Repeater>

Oct 13 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Stephen Miller | last post by:
I am using the OnItemDataBound event of Repeater control to nest a DataGrid within the Repeater. When I attempt to bind to the DataGrid using the DataSource method I get the error message "Object...
3
by: francois | last post by:
Hi, I have a little problem I am using a stored procedure to retrieve my date. What I want to achieve is to be able to "skip" some row from the resultset i retrieve back from the stored...
4
by: MattB | last post by:
This is just a rephrased version of a question I posted earlier. I think I'm closer now, so it seemed worthy of a new (more specific) post. In my repeater I'm dynamically creating text boxes, so...
7
by: charliewest | last post by:
Hello - I'm using a Repeater control to render information in a very customized grid-like table. The Repeater control is binded to a DataSet with several records of information. Within the...
1
by: voidfill3d | last post by:
I am looking to create a report via a table like structure similar to that of a report you would create in MS Access. For example: Category1 ---------------------------- ID Name Field1 ...
4
by: bill | last post by:
I have a Repeater control in a web user control. The web user control has a public method named PopulateRepeater which takes an ID as an parameter and populates the repeater control based on the...
8
by: fernandezr | last post by:
I would like to use a user control as a template inside a repeater. Some of the fields in the control should be hidden depending on whether or not there is data. I'm still a ASP .Net newbie so the...
4
by: Brad Baker | last post by:
I'm going a little crazy :) I'm trying to bind a repeater control to a dataset on page load using the following code: if (Request.QueryString != null) { string customerid = Request.QueryString;...
3
by: Leon Mayne | last post by:
If I have a datatable which looks like this: Record Id, Group Id, Name 1, 1, Test 1 2, 1, Test 2 3, 2, Test 3 4, 3, Test 4 Is it possible to use nested repeaters to group the information by...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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.