XXX Chats

Chat sluts

New value in gridview rowupdating event

We will use the Custom Validator control for this purpose.

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.Click on the "Advanced" button and check the "Generate INSERT, UPDATE and DELETE statements" checkbox (Figure 3). Now that you have configured the SQL Data Source control let's bind it with a Grid View control. Open its smart tag and configure it as shown in Figure 4.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.This will display the template designer for the column as shown in Figure 6.Next, drag and drop a Required Field Validation control below the Text Box.Here, our validation criteria is that the entered name must not contain title of courtesy (Mr./Mrs./Ms.). That is when you can handle certain events of Grid View control.We check the value entered in the Text Box using args. Especially the following events are important for validation point of view.Inside the event handler we added two validation conditions: We used the New Values collection to check the entered country.If the country is null then we set Cancel property of Grid View Update Event Args class to true.Set the Control To Validate property of Required Field Validator control to Text Box1 (i.e. Also, set its Error Message property to "Please enter company name".Note that by default all validation controls validate on the client side.

Comments New value in gridview rowupdating event