Struggling to get nested repeaters working although I feel I am close!
I am trying to create two nested repeaters each bound to a list of classes I created.
I am currently getting this error message:
DataBinding: 'TR_BLL.Forum' does not allow indexed access.
This is the code of the page:
<!-- Forum Group Repeater -->
<asp:Repeater ID="rptForumGroups" runat="server" OnItemDataBound="rptForumGroups_ItemDataBound">
<ItemTemplate>
<div class="content">
<div class="content-header">
<h3><%# DataBinder.Eval(Container.DataItem, "strName")%></h3>
</div>
<!-- Forum Repeater -->
<asp:Repeater ID="rptForums" runat=server>
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "[\"strTitle\"]")%>
</ItemTemplate>
</asp:Repeater>
<!-- End Forum Repeater -->
</div>
</ItemTemplate>
</asp:Repeater>
<!-- End Forum Group Repeater -->
And this is the code behind:
protected void Page_Load(object sender, EventArgs e)
{
// Bind Forum Groups
TR_BLL.ForumGroups ForumGroups = new TR_BLL.ForumGroups();
List<TR_BLL.ForumGroup> listForumGroups = new List<TR_BLL.ForumGroup>();
listForumGroups = ForumGroups.GetAllForumGroups();
rptForumGroups.DataSource = listForumGroups;
rptForumGroups.DataBind();
}
protected void rptForumGroups_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e)
{
// Bind Forums
TR_BLL.Forums Forums = new TR_BLL.Forums();
List<TR_BLL.Forum> listForums = new List<TR_BLL.Forum>();
listForums = Forums.GetAllForums();
Repeater rptForums = (Repeater)e.Item.FindControl("rptForums");
rptForums.DataSource = listForums;
rptForums.DataBind();
}
The top level repeater works fine as does the nested one when it is not nested.
"[\"strTitle\"]"instead of"strTitle". The issue looks like it is with the TR_BLL.Forum class, can you post that?