B
Big Charles
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>
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>