Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / DataGrid / November 2003

Tip: Looking for answers? Try searching our database.

Paging a datagrid

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Fabiano - 27 Nov 2003 22:57 GMT
Please,

i've created a datagrid that allow numbered paging.
But when i click over a page that must be called, i get this error:

System.Web.HttpException: Invalid CurrentPageIndex value. It must be >= 0
and < the PageCount

at my page, on Paging Event i'm using the commands bellow:

private void DataGrid1_PageIndexChanged(object source,
System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
{
DataGrid1.CurrentPageIndex = e.NewPageIndex;
DataGrid1.DataBind();
}

I get the error at the DataBind function. what could be wrong?

Tks

Fabiano
Michael Tkachev - 28 Nov 2003 08:49 GMT
hi,

This is a mistake because you don't fill datasourse in the datagrid!
You have to fill datagrid again after selected CurrentPageIndex.

For example:

DataGrid1.CurrentPageIndex = e.NewPageIndex;
DataGrid1.DataSourse = ...//Your sourse. and then you can make databind of
datagrid.
DataGrid1.DataBind();

bye-bye.

The Best Regards,
Web Developer
Michael Tkachev

> Please,
>
[quoted text clipped - 18 lines]
>
> Fabiano

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.