's GridView control realizes cell editable and easy to use _ Practical tips

Source: Internet
Author: User
Recently do a function, taking into account the ease of use of users, reduce pop-up pages, the use of point "edit" button without pop-up page directly the current row of cell content can be edited. Enter the page to display the following figure:

Click the Edit button to display the following figure:

The "Week" and "whether to go to work" numbered 1 are editable, and the click "Update" is saved when the edit is complete.
The data loading in the first image is achieved by:
Protectedvoid Gridview_rowdatabound (object sender, GridViewRowEventArgs e)
The modified data in the second diagram is achieved by:
Protectedvoidgridview_pue_rowupdating (object sender, Gridviewupdateeventargs e)
I thought we were going to make it, who knows? The Update button appears with the "Fire unhandled event rowediting" error:

Added to the GridView
Protectedvoidgridview_rowediting (object sender, GridViewEditEventArgs e)
Fix the problem, but the interface shown in Figure 2 occurs every time you need to click the Edit button two times, and the first time you click the Edit button is to jump into the Gridview_rowediting method and add code to the method:
Gridview.editindex= E.neweditindex;
Bindgrid ();
Solve the problem
Related Article

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: 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.