I've been struggling on this for half a day and then, I found out something that seems a bug to me.
I've got a GridView with DataKeyNames="product_id, product_image". I need the product_image key to do some validation before updating database.
Inside the GridView is an EditItemTemplate with a FileUpload used to change the product_image field.
The DataSource associated with the GridView has an UpdateCommand that goes like this :
UpdateCommand="UPDATE product SET product_image=@product_image WHERE product_id=@product_id"
Finally, in the gridViewProducts_RowUpdating handler, I set the product_image value like this :
FileUpload fileUploadImage = (FileUpload)gridViewProducts.Rows[e.RowIndex].FindControl("fileUploadImage");
string oldImage = gridViewProducts.DataKeys[e.RowIndex].Values["product_image"].ToString();
(do some da ...
Go to the complete details ...