Updating gridview control

When the end user clicks on an Edit button that row becomes editable, causing the Edit button to change to Update and Cancel buttons and the other columns to become Text Boxes.The end user can then update one or more column values and click Update to save their changes. Our first demo will look at how to create an editable Grid View whose data comes from a Sql Data Source.

For demonstration I have created a database (named Database.mdf) in which we have a table named tbl_Employee. Page Private con As New Sql Connection("Data Source=.; Initial Catalog=pubs; User ID=sa; Password=*****") Protected Sub Page_Load(By Val sender As Object, By Val e As System. Load If Not Is Post Back Then load Stores() End If End Sub Protected Sub load Stores() con. Data Bind() Dim columncount As Integer = grid View. So I have to specify how I want them to appear in the normal view and edit view.That’s why I have placed different templates like Item Template (for normal view) and Edit Item Template (for edit view).A Grid View Edit Event Args object is passed to the event-handling method, which enables you to determine the index of the current row and to indicate that the edit operation should be canceled.

You must have an account to comment. Please register or login here!