Congratulations to all monthly winners of May 2013 !!! They have won INR 2900 cash and INR 27497 worth prize.
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 29034 |  Welcome, Guest!   Register  Login
 Home > Forums > ASP.NET > Specified argument was out of range ...
Snvrk1985

Specified argument was out of range

Replies: 0 | Posted by: Snvrk1985 on 6/29/2012 | Category: ASP.NET Forums | Views: 274 | Status: [Member] | Points: 10  


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

 Responses below this adGet hundreds of .NET Tips and Tricks videos

  No reply found.


Reply - Please login to reply


Click here to login & reply

Found interesting? Add this to:


 Latest Posts

Write New Post | More ...

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 6/19/2013 6:41:44 AM