Problems encountered during DataGrid editing, update, and deletion operations

Source: Internet
Author: User

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!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.