Gridview edit not updating
Future installments will explore more advanced updating scenarios, such as customizing the Grid View's editing interface and programmatically setting the updated values. The UPDATE Table Name SET Column Name1 = @Parameter Value1 Column Name2 = @Parameter Value2 ...Column Name N = @Parameter Value N WHERE Primary Key Column Name1 = @Primary Key Value To Update1 AND Primary Key Column Name2 = @Primary Key Value To Update2 AND ...The Command Field is a column that shows Edit-related or Delete-related buttons, depending on its property settings.Checking "Enable Editing" adds a Command Field with its property set to True. When the visitor clicks the Edit button that row becomes editable.After updating the data, the Grid View is returned to its pre-editing state.To illustrate the Grid View's editing capabilities, let's step through the editing process from the end user's perspective.When we examined inserting data and deleting data we looked at doing so both through manually-created Web Forms and through data Web controls, like the Grid View or Details View.
What checking this checkbox does is add a Command Field to the Grid View's field list.
With the Sql Data Source control's , and so forth). If you are configuring this information via the Update Query property from the Properties window, then your screen should look like the following: Select Command="SELECT [Product ID], [Product Name], [Products].[Category ID], [Category Name], [Unit Price], [Discontinued] FROM [Products] INNER JOIN [Categories] ON [Products].[Category ID] = [Categories].[Category ID] ORDER BY [Product Name]" Update Command="UPDATE [Products] SET [Product Name] = @Product Name, [Category ID] = @Category ID, [Unit Price] = @Unit Price, [Discontinued] = @Discontinued WHERE [Product ID] = @Product ID" Note that each parameter in the Update Parameters collection is a Parameter object.
Recall that when using manually-created Web Forms in the inserting and deleting scenarios, we would use Control Parameter objects that referenced the particular Web control that held the parameter's value.
Updating data through manually-created Web Forms is a bit more difficult and less practical because the Web controls that make up the updating interface must also be populated with the values of the record being edited.
For example, to let a visitor edit a database record you first need to let them choose which record to edit.