Button to update row in gridview
Posted on 2012-03-21
I am new to asp.net and I am hoping you can help with a question on gridview controls. I have a gridview control that shows a list of transactions. I have added two buttons (Approve/Rescind) to the gridview that I would like to update a field on the record. There is a SQL data source that is attached to the gridview control and I have created two separate SQL data sources with the appropriate update statements for the updating the field. I have assigned the buttons with CommandName attributes of "Approve" and "Rescind" respectively. A couple of questions...
1. There is a transaction ID in the select statement used by the gridview. It is the primary key for the table and I would need to use this for my update statement. How do I get the transaction id associated with the buttons on a given row?
2. How would I initiate the update (assume this is done in the C# code)?