There can be several approaches taken for validating data. For our example we are going to use Customers table of Northwind database. Open its smart tag and choose "Configure Data Source" option to start Configure Data Source wizard.
Meanwhile, we can use the Validate Row event in the same way to prevent the user from exiting the current row.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.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.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).