I have applied pagination for my repeater control ,
but now the problem is as the number of pages grows that number of page number in poagination are getting duisplayed ,,, I dont want 100 of page numbers to be displayed into my repeater footer.. I want to show around 5 number and for next it will generate automatically as I click on next next
What I have tried:
<asp:Repeater ID="rptPaging" runat="server" OnItemCommand="rptPaging_ItemCommand">
<itemtemplate>
<asp:LinkButton ID="btnPage"
Style="padding: 8px; margin: 2px; background: #ffa100; border: solid 1px #666; font: 8pt tahoma;"
CommandName="Page" CommandArgument="<%# Container.DataItem %>"
runat="server" ForeColor="White" Font-Bold="True"><%# Container.DataItem %>
private void FillGridview()
{
try
{
DataSet dsState = new DataSet();
dsState = objStateMaster_M.GetAllStates();
ViewState["DtDate"] = dsState.Tables[0];
if (dsState != null)
{
//Create the PagedDataSource that will be used in paging
PagedDataSource pgitems = new PagedDataSource();
pgitems.DataSource = dsState.Tables[0].DefaultView;
pgitems.AllowPaging = true;
//Control page size from here
pgitems.PageSize = 5;
pgitems.CurrentPageIndex = PageNumber;
if (pgitems.PageCount > 1)
{
rptPaging.Visible = true;
ArrayList pages = new ArrayList();
for (int i = 0; i <= pgitems.PageCount - 1; i++)
{
pages.Add((i + 1).ToString());
}
rptPaging.DataSource = pages;
rptPaging.DataBind();
}
else
{
rptPaging.Visible = false;
}
rptState.DataSource = pgitems;
rptState.DataBind();
}
else
{
rptState.DataSource = null;
rptState.DataBind();
}
}
catch (Exception ex)
{
}
}