I'm using paging on my datagrid but have run into the following problem, when I choose to go to the next page I get the following error: Specified argument was out of the range of valid values. Parameter name: index. I am using a viewstate variable that I'm passing to my bindgrid method in order to get the date range that I want to occupy in my datagrid. So my bindgrid method looks like the following:
private void bindGrid()
sqlDataAdapter1.SelectCommand.CommandText="select * from mainTABLE where [date]='"
I use two datasets because the datagrid has two drop down list that are occupied with selections from another table.
The page changed event is the standard one as follows:
private void changePage(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
DataGrid1.CurrentPageIndex = e.NewPageIndex;
And the view selected date gets the date range to load into the bindgrid method from the calendar control as follows:
private void viewSelectedDate(object sender, System.EventArgs e)
ViewState["dateWorked"] = Calendar1.SelectedDate.ToLongDateString();
What am I missing? What have I done wrong?