Gridview rowupdating e oldvalues

Posted by / 18-Jul-2020 09:14

Gridview rowupdating e oldvalues

Let's proceed further by validating on the server side.

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.

Set the Control To Validate and Error message properties to the appropriate values. Up till now we used the validation controls to validate Grid View input on client and server side.

We check the value entered in the Text Box using args. Especially the following events are important for validation point of view.

We need to convert these Bound Fields to Template Fields.Double click on the Custom Validator control to go into the Server Validate event handler and write the following code in it. However, at times you many need more control and flexibility than that is provided by validation controls.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.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.

gridview rowupdating e oldvalues-42gridview rowupdating e oldvalues-33gridview rowupdating e oldvalues-49

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

One thought on “gridview rowupdating e oldvalues”