Update gridview row rowupdating event in asp net

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.

update gridview row rowupdating event in asp net-1

Free counters Added on January 19,2012 Follow Me @vmsdurano A bit About Me Disclaimer The opinions expressed herein are my own personal opinions and does not represent the opinions of my employers.

Nor does it represent the opinion of my dog, because I don’t have one.

In general, gridview control is used to populate the data in tabular format from different datasources and basically it derived from webcontrol class.

Actually gridview control is built with lot of features and this control is commonly used for all applications.

And here I’m explaining some basic functions of this gridview control such as insert edit and delete a record.

First, we need to prepare the database table and stored procedure for gridview operations such as insert, update & delete a records, here I’m using sql server 2008 for all database activities, for this sample I have created the customer table and stored procedure for all mentioned gridview operations.

I know this happens after an update command happens on the database, but I want to write my own custom update.

The Row Updating event fires fine , but gv2_Row Updated does not fire? Width="99%" Header Style-Css Class="ph Head" Css Class="phone Table" Grid Lines="Both" Auto Generate Edit Button="true" Auto Generate Delete Button="true" On Row Editing="gv2_Row Editing" On Row Canceling Edit="gv2_Row Conceling Edit" On Row Updated="gv2_Row Updated" On Row Updating="gv2_Row Updating" Edit Row Style-Back Color="Light Yellow" Data Key Names="id External ID" If you're manually binding data to the Grid View (not using a Data Source ID), then the Row Updating event will fire after an update command, but the Row Updated event will never fire. Aaron I should have been more specific as to why I need the Row Updated to fire.

Create the customer table in your own test database using below table script and insert some records initially to load gridview with data.

Once you execute the above table and insert scripts, you will get the below records in the table initially to load data into gridview control.

Click on the "Advanced" button and check the "Generate INSERT, UPDATE and DELETE statements" checkbox (Figure 3). Now that you have configured the SQL Data Source control let's bind it with a Grid View control. Open its smart tag and configure it as shown in Figure 4.

Tags: , ,