Gridview updating database
Follow bellow steps to know how to work with Grid View in ASP. NET 2.0 introduced a number of new Web controls designed for accessing and modifying data. NET 2.0's data source controls make it possible to retrieve, insert, update, and delete data without having to write the tedious dedata access code that was so commonplace in ASP. Previous installments of this article series have looked at returning, inserting, and deleting data using the Sql Data Source control. These controls can work in unison with the data source controls to facilitate inserting, updating, and deleting data.Granted, this is not that difficult to accomplish, but it isn't as easy as pointing and clicking and requires the page developer to write a bit of code. NET 2.0's data Web controls can provide an editing interface.In this article we will look at using the Grid View control to update data, although the Data List, Details View, and Form View controls are also suitable choices.
When editing with a Grid View we'll specified (as our's does), then the Grid View's smart tag will include a checkbox titled "Enable Editing." Check this checkbox to enable editing.
Virtual mode gives you a higher degree of control by allowing you to wait until a cell is actually being displayed to provide the value it will contain.
The following C# source code illustrate how to connect a Data Grid View to a database and new/update or delete the database values from Data Grid View.
Checking "Enable Editing" adds a Command Field with its property set to True. When the visitor clicks the Edit button that row becomes editable.
The Edit button disappears and in its place Update and Cancel buttons appear.