Subscribe to Subscribers
Talk to Webmaster Tony John

Online Members

Pawan Awasthi
More...


Forums » .NET » ASP.NET »

Specified argument was out of range


Posted Date: 29 Jun 2012      Posted By:: S.N.V.Rama Krishna     Member Level: Silver    Member Rank: 1499     Points: 5   Responses: 1



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[0].Controls[0] 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;




Responses

#678158    Author: Mohan M Devarinti      Member Level: Gold      Member Rank: 488     Date: 29/Jun/2012   Rating: 2 out of 52 out of 5     Points: 2

Hi SNV,

we can't get the control ids which are generated by the datapager I think so....


So, if do you wanna set the current pageindex, you can do like:

DataPagerProducts.SetPageProperties(CurrentPage * DataPagerProducts.PageSize, DataPagerProducts.PageSize, true);

Regards,
MURALI.



 
Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.



Next : Cannot able to access AsyncFileUpload??/showing error below??
Previous : How catch results of stored procedure in asp.net page
Return to Discussion Forum
Post New Message
Category:

Related Messages



Follow us on Twitter: https://twitter.com/dotnetspider

Active Members
TodayLast 7 Daysmore...

Awards & Gifts
Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
2005 - 2012 All Rights Reserved.
.NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
Articles, tutorials and all other content offered here is for educational purpose only.
We are not associated with Microsoft or its partners.