In previous post we have discussed about insert update and delete data in gridview using dataset and table adapter method.
In this post we will learn insert edit update and delete data in gridview control in using SQLConnection and SQLData Adapter method.
Row Updating Dim str Person ID As String = Direct Cast(Grid View1.
To String() Dim str Last Name As String = Direct Cast(Grid View1.
Step 1 – Create database table and create new web application. Step 3 – Add name space for sql connection Data Table object. Now, finishing design make connection between sql database and web application.
Take a look at the page load if you are binding on post back then the values get updated before you are able to access them.we can do the same thing by using other connection method like LINQ connection and SQLCommand and stored procedure method. Data; Step 5 - Auto Generate Delete Button=”True” and Auto Generate Edit Button=”True” Step 6 –Declare SQLConnction and SQLData Adapter object for connectivity.For understand edit update delete gridview example, First we insert records in to database and select records from database and bind it to gridview control, then update and delete record in gridview using sql dataadater method. Step 7 - Insert record to gridview and update, delete records in gridview.As described elsewhere in this tutorial, the View State allows ASP.NET to repopulate form fields on each postback to the server, making sure that a form is not automatically cleared when the user hits the submit button.