Gridview1rowupdating datatable spirituele dating community home

In this example, I used my own database called Sample DB which has Customers Table and basically contains the following field columns: As you have noticed in STEP 2, we have added six Text Box and a Button in the web form in order for us to type the information there and Insert them to the database.

Now let’s create a method for executing the Update or Insert.

The last parameter is a boolean value which tells the method whether to execute an Insert (false) or Update (true). In-order to perform Edit and Update in Grid View we need to use three events ( Grid View_Row Editing, Grid View_Row Canceling Edit , Grid View_Row Updating).

The above piece of code will also do the same as label in Item Template and Textbox in the Edit Item Template.

Now you can ask questions directly to me on my new site ASPForums.

For this sample to work, you must install the Sql Server 2008 R2 Express.

In case of the bound field’s we need to check what column it is and need to use index of that cloumn, which is little hard and even in future if we change the column order If you see the Last Template Field part in the above code, I am using the link buttons for edit, update, delete and cancel.

May be you may think why am I using link buttons as we are provided with some command field buttons by Grid View.

Search for gridview1rowupdating datatable:

gridview1rowupdating datatable-40gridview1rowupdating datatable-33

Leave a Reply

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

One thought on “gridview1rowupdating datatable”