I am attempting to implement a pagination bar above a table. I have a static <ul> element on my page:
<div><center><ul id="topnav" runat="server"></ul></center></div>
In my Page_Load event, I attempt to load it with page numbers:
foreach ( int linkpage in linkpages ) {
HtmlGenericControl li;
LinkButton pbut;
li = new HtmlGenericControl( "li" );
pbut = new LinkButton();
pbut.CommandName = "page";
pbut.CommandArgument = linkpage.ToString();
pbut.Text = linkpage.ToString();
li.Controls.Add( pbut );
topnav.Controls.Add( li );
}
However, when the control is actually rendered it posts as name 'ctlXX' (where XX is an incrementing number) and no argument, so I am unable to get the page number. The .Text attribute renders fine, however. What am I doing wrong? Is this entirely the wrong approach?