Row updating event in asp net
This can be a useful opportunity to save information to a historical record.For example, maybe you want to check if the has user actually changed anything before you save the before and after information to a historical table. Place Link Button Edit in Item Template and Link Button Update and Cancel in Edit Tamplate of Gridview's column. Fire Grid View's Row Editing event for Link Button Edit. Fire Grid View's Row Updating event for Link Button Update. Fire Grid View's Row Canceling Edit event for Link Button Cancel. Set Command Name propery of Link Buttons according to their respective event. Set Grid View's Data Key Names Property to record ID (ID=Primary/Unique key of student table) 7.
Well, if you’ve got a Grid View, you may want to have programmatic decision making logic in place based on an update event happening.To avoid this we need to keep the property Read Only as false, Then in the edit mode nothing will happenes. The reason I use Template Field instead of Bound Field is that, it is very easy to grab those controls in the codebehind if we user labels or textboxes.In case of the bound field’s we need to check what column it is and need to use index of that cloumn, which is little hard and even in future if we change the column order If you see the Last Template Field part in the above code, I am using the link buttons for edit, update, delete and cancel.By the way, if you find the information I’m giving is useful, then have a look at some of the other Web Forms related articles I’ve written.At this time in 2017, the Web Forms technology is not as commonly used as it once was, but is still relatively prevalent, especially in legacy applications.