views:

276

answers:

0

hi


1) If you are using ConflictOptions.OverwriteChanges, then you also need to set GridView.DataKeyNames, else GridView won’t pass these parameters to the SqlDataSource and thus the Delete operation won’t succeed.

But if you’re using ConflictOptions.CompareAllValues, then DataKeyNames doesn’t have to be set. Why?


2) But why need we set DataKeyNames for delete operation to work? I realize this way GridView will know which columns make the primary key, but we could just as easily delete a record without telling GridView what column(s) is a primary key.

GridView could simply pass parameters back to SqlDataSource ( the way it does when performing update or selection ) without having to know which parameters constitute a primary key


Thank you