I have write this code
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
string rowindex = Convert.ToString(GridView1.Rows[GridView1.SelectedIndex].Cells[1].Text); //there i find that GridView1.SelectedIndex value always -1
//string s = Convert.ToString(GridView1.Rows[e.RowIndex].Cells[1].Text); //i try this but when i try to write rowindex then it not appear.
Response.Write("");
ModalPopupExtender1.Show();
}
So how excess index?
Gridview index problem,how excess editing row index?
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.


Posted Oct 15, 2010, 9:11 PM EDT
string rowindex = Convert.ToString(GridView1.Rows[e.NewEditIndex].Cells[1].Text);
Here you are not selected any row, so you will get SelectedRowIndex will be -1;
Use e.NewEditIndex this will return index in which row you are currenlty editing....
Hope this helps you.