Home / outdoor dating agency / Rowupdating get textbox value

Rowupdating get textbox value

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.

NET 2.0 Grid View control allows us to quickly edit and delete records.

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

341 comments

Leave a Reply

Your email address will not be published. Required fields are marked *

*