Asp net rowupdating newvalues

by  |  23-Jul-2017 22:24

You can not attach validation controls directly to these Text Boxes.We need to convert these Bound Fields to Template Fields.Simple Insert, Select, Edit, Update and Delete in Asp. – The above block of codes in Row Updating event, finds the control in the Grid View, takes those values in pass it to the Customers Cls class Update method.

asp net rowupdating newvalues-71asp net rowupdating newvalues-69

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

The secret lies in the event handlers–in this case, the Row Updating event handler. Grid View Update Event Args object that is passed in. This page contains copyright material from you have no rights to copy and paste the full text into your own blog even if you have written permission to the contrary.

Community Discussion