Gridview rowupdating event example Meet up to fuck free
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.
On the first step of the wizard click on "New Connection" button to open a dialog as shown in Figure 1.
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.
This tells Grid View that the event handler should be cancelled.
Click on the Edit button of the Grid View so that it goes into the edit mode.
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.