Gridview rowupdating keys

28 Oct

A datakey represents the primary key field or field of a record that can uniquely identify it in a data-bound control. Row Index represents the index of the particular row.Many a times in our applications we use primary keys to get control of the particular record in the gridview.

If you don't use one of the Data Source controls, you are required to handle the Row Updating event. To String Message="Conversion from string "Location Name" to type 'Integer' is not valid." I would prefer to get the cells by name rather then by location e.g. Keys is an array of all the data keys you define for the gridview (Data Key Names="id", where "id" is the field name from your database query) e. Old Values are arrays of all the fields in the gridview data source that are NOT leys, where, as you might guess, e. You access the values stored in the event by index or name: e. So, to update, you might set the parameters as id = e. of course, if I have 20 columns I could define 20 data keys but I just wondered if there is another way instead of: Sql Data Source Locations. PS: location name is not an integer You don't access the table cells by name. So, basically, instead of looking for table cells, look for the appropriate e. New Values Hi mckrecker, thanks for your reply but I dont need to differ between old and new values since I set a datakey which is the unique ID in my db and I update where unique ID = @unique IDselected of column. New Values -- it will have all the values, as does e. There are two in that event so data source controls can differnitate bewteen the two.