Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Feb 01, 2007 01:18 AM|LINK
You could try something like this. This example was checks for the value in the first column when a row is selected, but you could do something similar with the edit row. I started at the selected row, then searched through the rows (moving up the table)
until a row is found with the right number of cells, then grab the value.
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
int index = GridView1.SelectedIndex;
int columnCount = GridView1.Columns.Count;
for (int i = index; i >= 0; i--)
GridViewRow row = GridView1.Rows[i];
int cellCount = row.Cells.Count;
if (cellCount == columnCount)
Label1.Text = row.Cells.Text;
Hope that helps.