Asp gridview onupdating

posted by | Leave a comment

A common way to use these collections is to HTML-encode the values supplied by the user before they are stored in the data source.

The following code example demonstrates how to display data that is retrieved from a Microsoft SQL Server database in a Drop Down List control and update the record using a Text Box control.

A Grid View Updated Event Args object is passed to the event-handling method, which enables you to determine the number of rows affected and any exceptions that might have occurred.

You can also indicate whether the exception was handled in the event-handling method by setting the On Row Updated Row Canceling Edit On Row Canceling Edit Row Deleted On Row Deleted Row Deleting On Row Deleting Row Editing On Row Editing Row Updating On Row Updating Grid View Class System.

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.

asp gridview onupdating-2asp gridview onupdating-37asp gridview onupdating-44asp gridview onupdating-71

event is raised when a row's Update button is clicked, but after the Grid View control updates the row.

Luckily in the Grid View Updated Event Args we can get the updated row’s Data Key Names (which in this case is ‘Id’).

Here’s the code to get the Id: There’s now no other way to get the edited row number other than looping through the rows of the Grid View and comparing the datakey value of each row with the key that was passed to the on Row Updated method from the Grid View Updated Event Args parameter.

You may be asking yourself: what’s the question here?

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.

Leave a Reply

method of documenting tracking and updating software licenses