Products/Services Website Design DNN Web Hosting Bespoke Software Solutions
Spotlight Business Made Simple Credica Wilson Chauffeur Services Lysander Whitegrove FC Ultramagic Bracklesham Boardriders Johns Motors
DotNetNuke Modules janet.Articles janet.ReferMe! janet.Menu janet.Gallery janet.Guestbook janet.GoogleAds janet.Marquee
DotNetNuke Skins janet.VeniceGrandCanal janet.ParisSkyline janet.ColourBar
Articles HTML Javascript ASP .net DotNetNuke Web Robots
I recently received this error whilst working with a datagridDotNetNuke.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 I had implemented a search on the data, which could be called after the entries in the datagrid had been paged. This meant that the page reference for the datagrid could be, say 7, whilst slearly the result from the search is likely to be page 1.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 SubThe first obvious step was to modify that and set it to page 1. Afterall, it was a figure 1 that I was seeing at the bottom of the datagrid for the page number.Further investigation led me to understand that whilst the displayed page numbers start at 1 and work upwards, in reality they follow the usual array convention by being handled from 0 upwards. Therefore my solution was:
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
NAT July 2005 (Revised)
Copyright © 2004-2007 Janet Systems Ltd.
DotNetNuke Website design and hosting from £15.00 per month. More...
Looking for a website design company in the Thames Valley, call us on 01628 566178
DotNetNuke ModulesDotNetNuke Skins
from Janet Systems