:: Home     :: MS Dynamics CRM     :: .Net 1.1     :: .Net 2.0     :: Sharepoint Portal     :: Ajax

  login:        
  passwords:  

Invalid CurrentPageIndex Value 

suppose you got an error as below.
Megasolutions.Services.Exceptions.ModuleLoadException: Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount. ---> System.Web.HttpException: Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount. at

Having implemented the paging code:

      Private Sub grdListItem_PageIndexChanged(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridPageChangedEventArgs) Handles grdListItem.PageIndexChanged
         grdListItem.CurrentPageIndex = e.NewPageIndex
         BindData(txtSearch.Text, ddlSearchType.SelectedIndex.ToString)
      End Sub


Set the currentpageindex back to 0 to solve the problem.

      Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnSearch.Click
         grdListItem.CurrentPageIndex = 0
         grdListItem.PageSize = CType(ddlRecordsPerPage.SelectedItem.Text, Integer)
         BindData(txtSearch.Text, ddlSearchType.SelectedItem.Value)
      End Sub


Copyright 2005-2015, Megasolutions Ltd  |   Privacy Policy