Asp net datagrid rowupdating

posted by | Leave a comment

Out of these events Row Updating and Row Deleting are possibly the most common ones.

These events are raised before updating and deleting the record respectively.

This will convert them from Bound Field to Template Field.

Now from the smart tag of the Grid View choose "Edit Template" and then select "Edit Item Template" of Company Name column.

NET 2.0 Grid View control allows us to quickly edit and delete records.

However, most of the real world cases call for validating the data being edited or deleted. Drag and drop an SQL Data Source control on the web form.

Just like we attached the Required Field Validator control to the Text Box, attach a Custom Validator to the Contact Name column. If you run the web form and try entering wrong value in the Contact Name column then you will see the error message displayed as before and the value will not be accepted by the Grid View control.The Grid View Update Event Args class has three important collections - Old Values, New Values and Keys.The Ole Values collection contains list of old column values, the New Values collection contains the list of new values entered by the user and the Keys collection contains the list of primary key values as defined by Data Key Names.We need to convert these Bound Fields to Template Fields.In order to do so select "Edit Columns..." from the smart tag of the Grid View. Select Company Name and Contact Name fields and click on "Covert this field into a Template Field" link.

Leave a Reply

Usa chat sex rooms online without registration