Rowupdating object sender gridviewupdateeventargs e

Get String("Grid View_Unhandled Even t", new object[] { this. In this Article you can learn how to edit, update, delete, and cancel in gridview.First drag and drop Gridview from the toolbox to page.Now in gridview properties set Auto Genarate Columns to False.If user clicks the Cancel button while Grid View is in editing mode, you need to Cancel the Editing process and also need to reset the Edit Index property to -1 in the Row Canceling Edit event of the Grid View control as shown below: The last step is to handle the Row Updating event to actually update the back end database.To do this we first need to obtain the reference of the current row by using its index no as shown in the first line below.In data driven web sites, users are normally allowed to view data and administrators are allowed to add, edit or delete data.In this tutorial I will show you how you can create an editable Grid View control for administrators to modify database records directly into the Grid View control.

Next event is the Grid View Row Editing event to give ASP. You need to set the Edit Index property of the Grid View with the New Edit Index property of the Grid View Edit Event Args class.

Here I am going to Edit only two columns name and marks.

Figure 2 For Editing a Gridview: Fogure 3 In Gridview Events: Double Click on Row Editing Event and write below code When you click on Edit link it shows Update, Cancel links For Updating a Gridview: Figure 4 Updating link is used to update a Particular row in emp table using Gridview. Find Control("lblid"); Text Box textname = (Text Box)row. Open(); Sql Command cmd = new Sql Command("update emp set marks=" textmarks.

Last line of the following code is calling a local method for updating the database and passing all the parameters to this method.

Please keep in mind that there are many different ways to update the database using the Grid View control depending on the type of data you are updating and the functionality the user need and there are many solutions to achieve the same end result.

Leave a Reply