I want to make a custom paging for my gridview in asp.net 'cause i have a lot of information in my database. My problem is when i generate linkbuttons. I put them in a panel, but i have more than 7000 buttons for my pages. When i add them into my panel, it displays me all of them on 10 lines in my page. I need to display only 10 and when i press the last of them to display other 10 buttons. My code:
for (int index = 0; index < nrPages; index++)
{
int pageNo = index + 1;
LinkButton lnk = new LinkButton();
lnk.Click += new EventHandler(PageChange);
lnk.ID = "PageLink" + pageNo.ToString();
lnk.CommandName = "Page";
lnk.Text = " " + pageNo.ToString() + " ";
lnk.CommandArgument = index.ToString();
PanelPager.Controls.Add(lnk);
}
public void PageChange(object sender, EventArgs e)
{
int pageIndex = int.Parse((sender as LinkButton).CommandArgument);
object dataSource = GetDataSource(OwnerId, null, pageIndex);
PushData(dataSource);
}
Here i use my linkButton