I have this custom paging, and I'm trying to add attribute to the ListItem.
I'd like to use this attribute (or class) to style the item with css later on.
aspx code:
<asp:Repeater ID="rptPager" runat="server">
<ItemTemplate>
<asp:LinkButton ID="lnkPage" runat="server" Text = '<%#Eval("Text") %>' CommandArgument = '<%# Eval("Value") %>' Enabled = '<%# Eval("Enabled") %>' OnClick = "Page_Changed"></asp:LinkButton>
</ItemTemplate>
</asp:Repeater>
Here's the relevant code behind:
if (currentPage > 5) {
ListItem li = new ListItem("...", "", false);
li.Attributes.Add("extra", "true");
pages.Add(li);
}
Here's the html generated for that item:
<a id="MainContent_rptPager_lnkPage_2" class="aspNetDisabled">...</a>
Just to clarify:
I'm also adding more items before and after this.
Also the item might not get generated if there aren't enough pages.
I end up with something like this:
First 2 3 4 ... >> Last
or:
First << ... 3 4 5 6 7 8 9 >> Last