Gridview rowupdating error handling Best adult dating web sites

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.Enter the database details as per your setup and click on OK.On the next step select Customer ID, Company Name, Contact Name and Country columns (Figure 2).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.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.

Now from the smart tag of the Grid View choose "Edit Template" and then select "Edit Item Template" of Company Name column.We will use the Custom Validator control for this purpose.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.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.

Leave a Reply