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.
However, most of the real world cases call for validating the data being edited or deleted. Open its smart tag and choose “Configure Data Source” option to start Configure Data Source wizard.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.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.This will convert them from Bound Field to Template Field.