i am using list view. In data pager i have written _PreRender event. under it i have written code as
protected void Pagerindex_PreRender(object sender, EventArgs e)
{
int CurrentPage = 0;
Int32.TryParse(Request.QueryString["page"], out CurrentPage);
CurrentPage = CurrentPage.Equals(0) ? 1 : CurrentPage;
Button PreviousLink = Pagerindex.Controls[-1].Controls[-1] as Button;
Button NextLink = Pagerindex.Controls[0].Controls[2] as Button;
if (PreviousLink != null)
{
if (CurrentPage.Equals(1))
{
PreviousLink.Visible = false;
}
else if (CurrentPage > 1)
{
PreviousLink.Visible = true;
}
}
if (NextLink != null)
{
if ((CurrentPage * Pagerindex.PageSize) >= Pagerindex.TotalRowCount)
{
NextLink.Visible = false;
}
else
{
NextLink.Visible = true;
}
}
}
i am gettin error at
Button PreviousLink=Pagerindex.Controls[0].Controls[0] as Button;
Reply |
Reply with attachment |
Alert Moderator