Question

I have been searching for a while now but cant seem to find the answer.

I would like to show a counter in my carousel with on the left the current item (working) and on the left the total amount of items.

My code:

<asp:Repeater ID="PayslipCarouselRepeater" runat="server" Visible="false"         OnItemDataBound="PayslipCarouselRepeater_ItemDataBound">
<ItemTemplate>
        <li>
            <table>
                <tr>
                    <td> 
                        <asp:Literal runat="server" Text= '<%#(((RepeaterItem)Container).ItemIndex+1).ToString() + " van " + TOTALCOUNTROWS %>'></asp:Literal>

                        <asp:Panel ID="pnlItem" runat="server"></asp:Panel>
                    </td>
                </tr>

            </table>
        </li>
    </ItemTemplate>
</asp:Repeater>

TOTALCOUNTROWS needs to show the total amount of rows.

I already tried to do this from the code behind but without success.

Isn't there a simple way to do this like I did on the left side?

Was it helpful?

Solution

Before calling DataBind() method of repeater save total count of items to TOTALCOUNTROWS public/protected field/property and then only call DataBind().

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top