Handle rowupdating

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

handle rowupdating-20handle rowupdating-72handle rowupdating-68

Add Grid View1_Row Updating event handler as shown below: The Row Updating event handler receives an event argument of type Grid View Update Event Args.The Grid View Update Event Args class has three important collections – Old Values, New Values and Keys.We check the value entered in the Text Box using args. Especially the following events are important for validation point of view.Out of these events Row Updating and Row Deleting are possibly the most common ones.You can attach validation controls to the Template Fields to perform client side or server side validation.

If you need more control you can also handle Row Updating or Row Deleting events of the Grid View.Note that by default all validation controls validate on the client side.Right click on the Grid View and select “End template editing” Run the web form.Here, we set the Data Source of the Grid View to Sql Data Source1. We also enable paging, sorting and editing features of the Grid View.By default when the Grid View controls goes in edit mode, it displays Text Boxes for entering values.On the next step select Customer ID, Company Name, Contact Name and Country columns (Figure 2).