The Grid View Update Event Args class has three important collections - Old Values, New Values and Keys.The Ole Values collection contains list of old column values, the New Values collection contains the list of new values entered by the user and the Keys collection contains the list of primary key values as defined by Data Key Names.By default when the Grid View controls goes in edit mode, it displays Text Boxes for entering values.You can not attach validation controls directly to these Text Boxes.
We check the value entered in the Text Box using args. Especially the following events are important for validation point of view.
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.
This way you can attach client side validation controls to the Grid View columns.
Let's proceed further by validating on the server side.
This will display the template designer for the column as shown in Figure 6.