Hi, I have created a nested repeater using dataset relations before, but am having real trouble adign a third level
In the code behindCode:<asp:Repeater ID="rptModules" runat="server"> <HeaderTemplate> <table> </HeaderTemplate> <ItemTemplate> <tr style="background-color:yellow;"><td><%#Eval("modTitle")%></td></tr> <asp:Repeater ID="rptSlides" runat="server"> <ItemTemplate> <tr style="background-color:Cornsilk;"><td><%#Eval("slideid")%></td></tr> <asp:Repeater ID="rptUserAnswers" runat="server"> <ItemTemplate> <tr style="background-color:SpringGreen;"><td> <%#Eval("answertext")%> </td></tr> </ItemTemplate> </asp:Repeater> </ItemTemplate> </asp:Repeater> </ItemTemplate> <FooterTemplate> </table> </FooterTemplate> </asp:Repeater>
Do I have to cast the third repeater and then databind it the same as the second one?Code:Public Sub LoadData(ByVal reload As Boolean) If reload = True Then Dim myConnection As New SqlConnection(System.Configuration.ConfigurationManager.AppSettings("DatabaseURL")) Dim myCommand As New SqlCommand("SelectBestAnswer", myConnection) myCommand.CommandType = CommandType.StoredProcedure myCommand.Parameters.Add("@userID", SqlDbType.UniqueIdentifier) myCommand.Parameters("@userID").Value = UserID() Dim ad As New SqlDataAdapter(myCommand) ds = New DataSet ad.Fill(ds) ds.Relations.Add(New DataRelation("modSlide", ds.Tables(0).Columns("moduleID"), ds.Tables(1).Columns("moduleID"))) ds.Relations.Add(New DataRelation("slideAnswer", ds.Tables(1).Columns("SlideID"), ds.Tables(2).Columns("SlideID"))) If Not ds Is Nothing Then rptModules.DataSource = ds.Tables(0) rptModules.DataBind() End If myConnection.Close() End If End Sub Protected Sub rptModules_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rptModules.ItemDataBound If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then Dim dr As DataRowView = CType(e.Item.DataItem, DataRowView) Dim innerRep As Repeater = TryCast(e.Item.FindControl("rptSlides"), Repeater) Dim drv As DataRowView = TryCast(e.Item.DataItem, DataRowView) If Not IsNothing(innerRep) Then innerRep.DataSource = drv.CreateChildView("modSlide") innerRep.DataBind() End If End If End Sub
Can anyone help as I ahve been struggling with this for a couple of hours




Reply With Quote