PairDataGridThe following problems are encountered during editing, updating, and deleting operations:
1.The Update button does not respond.
Cause:# Region WebTheCodeThis sentence is not found in
This. Maid + =
New system. Web. UI. webcontrols. Maid (this. Maid updatecommand );
You can manually add errors that may occur during page operations.
2.The index is out of the range. It must be a non-negative value and smaller than the set size. Parameter Name: Index
Cause: No settingsDatakeyfieldSet as in the databaseIDBecause
String empid = This. datagrid1.datakeys [E. Item. itemindex]. tostring ();
ToDatakeysFill the data source.IDField;
When the attribute is modifiedDatakeyfieldAdd the primary key of the required database.
3 . The value of currentpageindex is invalid. It must be greater than or equal to 0 and smaller than pagecount
Cause: the current pageCurrentpageindexIn the last page, but when you delete the last record, the last page does not exist.ToException generation
Add the code before binding data.
If (maid! = 0) & (INT) E. Item. itemindex = 0 ))
{
If (maid. Count = 1)
Datagrid1.currentpageindex-= 1;
}
========================================================== ==============================
Today I met the above3Question. You have to study hard!