Technical · .NET Development

Grid changes in Edit Event–Framework 4.0

November 19, 2010

.NET Development

Grid changes in Edit Event–Framework 4.0

One of the clients of 3Metas uses a significant set of ASP.Net GridView controls for its mission-critical application. For various design considerations, these grids use images to indicate record modification, but instead of editing the record in the grid itself, when the icon is clicked the user is directed to a form with more validations and information; when the editing finishes, the user returns to the grid — very elegant in terms of usability and user experience.

To control the editing event and obtain the id of the record being modified, the control's RowEditing event is used. In versions 2 and 3.5 of the framework this behavior worked perfectly; however, when migrating the solution to framework 4.0 and Visual Studio 2010, this navigation flow stopped behaving in the usual way: now when the user finishes the editing process and returns to the page with the GridView control, the entire grid is in edit mode.

This change introduced in Framework 4.0, which affects many lines of already-built code, is reported in Connect and in the forum of ASP.Net; for us, the quickest solution and the one that introduced the fewest problems was to cancel the editing of the record at the end of the method using

e.cancel = true; //cancel the editing process due to changes in the behavior of framework 4.0

Probably the best way to achieve this navigation effect was not exactly to use the RowEditing event, but to use a link or image column template; even to process something before navigating to the edit form, a button template or a custom template could have been used, but our client's application was already built that way and making that change was not viable.

www.juanpelaez.com

Need Expert Help?

Let's discuss how I can help with your technical challenges

Schedule a Consultation

Get the next one in your inbox

More like this, once a week. The Digest covers AI systems and agents in one weekly edition.

Confirm by email to complete your subscription. Unsubscribe anytime.

Related reading

More in the Digest — a weekly roundup of AI and agents news — or start with AI Strategy. Want help with this? Tell me about your needs →