I am working with a two nested data repeaters, and I want to allow paging for the outer repeater.
Here is what I have so far:
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="LinqDataSource1" OnItemDataBound="Repeater1_ItemDataBound">
<HeaderTemplate>
<div class="group">
</HeaderTemplate>
<ItemTemplate>
<div class="question"><%#Eval("QText") %></div>
<asp:HiddenField ID="HiddenField1" runat="server" Value='<%# setQID(Eval("QID"))%>' />
<%-- THE INNER REPEATER--%>
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="LinqDataSource2">
<HeaderTemplate>
<div class="answer">
</HeaderTemplate>
<ItemTemplate>
<%# (GetAnswer(Eval("AnsQID"))) != 1 ? (displayAnswer(Eval("AText"))) : ""%>
</ItemTemplate>
<FooterTemplate>
</div>
</FooterTemplate>
</asp:Repeater>
<%-- THE INNER REPEATER ENDS HERE--%>
</ItemTemplate>
<FooterTemplate>
</div>
</FooterTemplate>
</asp:Repeater>
I have googled for this, searched everywhere and found a lot of ways to approach this. I am using LinqDatasources and two repeaters. What is the best way to do this ?
To page the outer repeater i have used the method outlined in this post in the past. I don’t think it should make much difference to the outcome if your repeater is nested. Your inner repeater will count as one row.
Repeaters generally though don’t have great support for paging. You could consider using ListView (if using ASP.Net 3.5 or greater) or GridView (ASP.Net 2.0 or greater) which have more support for paging out of the box.