I cut and pasted this code straight from the help file:
private void grdDRURL_Update(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
// Get the item to be updated
this.grdDRURL.EditItemIndex = e.Item.ItemIndex;
// Retrieve the previous Order Detail DataSet
DataSet dsURL = (DataSet)Session["dsURL"];
// Save the DataSet (the DataGrid automatically binds back)
this.boDRURL.SaveDataSet(dsURL);
// Reset the edited item and rebind the DataGrid
this.grdDRURL.EditItemIndex = -1;
this.BindControl(grdDRURL);
}
The problem is the EditItemIndex property is correct before the SaveDataSet call. When I trace through the code behind the SaveDataSet call I can see that in the BindBack method of mmDataGrid the EditItemIndex is -1. This causes and exception to be thrown.
Rip Ryness
International Falls, MN