Gridview values not updating
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.These controls allow page developers to declaratively access and modify data without writing any code to perform the data access. In this article we will examine basics of using the Sql Data Source and Grid View controls to update records from a database.This article is one in a series of articles on ASP. In particular, we look at enabling editing support in the Grid View. This article focuses on the Sql Data Source control; for a detailed look at updating with the Object Data Source, refer to the "Editing, Inserting, and Deleting" tutorials in my Working with Data in ASP. Let's explore the updating "action" for the Access Data Source and Sql Data Source controls in more detail. NET 2.0 introduces three new data Web controls: the Grid View, the Details View, and the Form View.(By default, the button caption is "Edit.") When users save a change, the dictionary contains the names and values of fields that uniquely identify the record to update or delete, and always contains the original values of the key fields.To specify which fields are placed in the control was first bound to the data source.To cancel the update operation, set the collections, if necessary, before the values are passed to the data source.A common way to use these collections is to HTML-encode the values supplied by the user before they are stored in the data source.
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 ...This enables you to provide an event-handling method that performs a custom routine, such as canceling the update operation, whenever this event occurs.A Grid View Update 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 update operation should be canceled.Matt took the road to update all the rows whether they were changed or not.In this article we are going to take a look at an alternative method of updating only the changed rows.