Validating data datagrid

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".

Note that by default all validation controls validate on the client side.

Inside the event handler we added two validation conditions: We used the New Values collection to check the entered country.

If the country is null then we set Cancel property of Grid View Update Event Args class to true.

This tells Grid View that the event handler should be cancelled.

The New Values collection is read/write collection and in the second if condition we set the Country to India. You will find that the data is not accepted by the Grid View.

Right click on the Grid View and select "End template editing" Run the web form.

Click on the Edit button of the Grid View so that it goes into the edit mode.

validating data datagrid-87

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.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).Make Company Name blank and click on Update button.You should see an error message as shown in Figure 7.

Leave a Reply

  1. Free online xxx chat without sign in 17-Nov-2017 19:53

    We’re doing a lot of things slightly on the activism side and certainly on the importance of love and equality.”“Expectations started to grow both from our guests and the media and then from ourselves. We honestly thought we were going to do a 60 person destination wedding and call it a day. Read the full story here…David Tutera is a famous fashion designer, celebrity wedding planner, and author of America.

  2. about online dating 23-Jul-2017 10:48

    We saw rays, barracuda, lionfish and SHARKS, oh my!