Gridview rowupdating event in c net

In our example we will illustrate the use of Updating event for the validation purpose.

Add Grid View1_Row Updating event handler as shown below: The Row Updating event handler receives an event argument of type Grid View Update Event Args.

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.

We check the value entered in the Text Box using args. Especially the following events are important for validation point of view.Set the Control To Validate and Error message properties to the appropriate values. Up till now we used the validation controls to validate Grid View input on client and server side.Double click on the Custom Validator control to go into the Server Validate event handler and write the following code in it. However, at times you many need more control and flexibility than that is provided by validation controls. Net Grid View control with simple Data Set or Data Table, and also explains the methods like Insert, Edit, Update and Delete function in the Grid View control.You can see most of the articles and tutorials in many websites teach you the way to bind a Grid View control to the database with some Data Source controls such as SQLData Source, Object Data Source, Access Data Source and even XMLDatasource.

Search for gridview rowupdating event in c net:

gridview rowupdating event in c net-88gridview rowupdating event in c net-51

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

Leave a Reply

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

One thought on “gridview rowupdating event in c net”