I need to get the productID out of a GridView control, and place it in a variable. I thought i had it working by using the rowCreated event, But i seem to get the previous rows ID for instance if the id for row one is 7 and the id for row two is 8 and i click on row two i get 7 instead of 8 and so on threw the rest of the grid. Can someone help me figure out what is going on and how to fix it. Below is the code i have.
protected void GridView4_RowCreated(object sender, GridViewRowEventArgs e)
foreach (GridViewRow myRow in GridView4.Rows)
string intString = myRow.Cells.Text;
Label22.Text = intString;
GridViewRow row = GridView4
Label22.Text = row.Cells.Text;