Use rowupdating - validating diffie hellman public private keys
You should see an error message as shown in Figure 7.This way you can attach client side validation controls to the Grid View columns.
We will use the Custom Validator control for this purpose.
However, most of the real world cases call for validating the data being edited or deleted. Drag and drop an SQL Data Source control on the web form.
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.
Next, drag and drop a Required Field Validation control below the Text Box.
Set the Control To Validate property of Required Field Validator control to Text Box1 (i.e. Also, set its Error Message property to "Please enter company name".
You can not attach validation controls directly to these Text Boxes.
We need to convert these Bound Fields to Template Fields.
These events are raised before updating and deleting the record respectively.
In our example we will illustrate the use of Updating event for the validation purpose.
The following C# program shows how to filter and sort a Data Grid View by using a Data View.
The Data Grid View control in C# provides automatic sorting, so that you can manually sort any column in the datagridview control.
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.