Gridview Boundfield and checkbox
Posted on 2009-07-09
I have a gridview that is populated from a database. The gridview has a checkbox in an ItemTemplate field. I want to loop through the gridview, find the rows that have been checked, extract the value from a boundfield in the gridview and pass this value to a stored procedure that updates the database.
I have the code to loop through the gridview to see if the row is check and the code to update the database, however, I need the correct code to extract the value from the boundfield. I tried using something similar to "TextBox2.Text = GridView2.SelectedRow.Cells(2).Text", however, I receive an error message because the row is not selected.
Any assistance would be greatly appreciated.