I need to select the row of a gridview using code behind. The following code identifies the selectedvalue of the selected row. Then the gridview is updated. Then I would like to reselect the row of the gridview that was previously selected. I used a textbox as a test, and the correct selectedvalue is displayed in the textbox after updating the gridview. I just need to know how to reselect the correct row. Here's the code I have so far:
protected void fv_ven_det_ItemUpdated(object sender, FormViewUpdatedEventArgs e)
{
//Get the selected value of the selected row in rg_vendors gridview
int rg_ven_sv = (int)rg_vendors.SelectedValue;
//Refresh rg_vendors gridview
rg_vendors.DataBind();
//Select the row again in rg_vendors using the value from rg_ven_sv
//The correct value is visible in the test textbox
test.Text = rg_ven_sv.ToString();
}