Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Paging ERROR with 2 Datagrids


Message #1 by jude@j... on Wed, 13 Mar 2002 21:21:07
Hi.



I have a web page that worked fine with one datagrid on it, including 

datagrid paging.



I added a second datagrid that pulls records from a different dataadapter 

and dataset than the first datagrid.



Dependent upon the link clicked by the user, either datagrid dg1 or dg2 

will display.



The grids display data fine, but now, I am getting the below error when 

attempting paging on either datagrid. The error is occurring when the 

DataBind() statement is executed.



Note that the debugger is reporting the correct CurrentPageIndex and 

PageCount just before the DataBind. CurrentPageIndex is always >=0 and < 

PageCount. This should not trigger an error.



Any assistance would be appreciated.



Thanks!



THE ERROR:



Exception Details: System.Web.HttpException: Invalid CurrentPageIndex 

value. It must be >= 0 and < the PageCount.



Source Error: 



An unhandled exception was generated during the execution of the current 

web request. Information regarding the origin and location of the 

exception can be identified using the exception stack trace below.  



Stack Trace: 



[HttpException (0x80004005): Invalid CurrentPageIndex value. It must be 

>= 0 and < the PageCount.]

   System.Web.UI.WebControls.DataGrid.CreateControlHierarchy(Boolean 

useDataSource)

   System.Web.UI.WebControls.BaseDataList.OnDataBinding(EventArgs e)

   System.Web.UI.WebControls.BaseDataList.DataBind()

   sitelinx.WebForm1.dg1_PageIndexChanged(Object source, 

DataGridPageChangedEventArgs e) in 



(The rest of the trace was omitted.)




  Return to Index