DataKeyNames
GridView的DataKeyNames属性设为"ID,Name"
GridView1.DataKeyNames = new string[]{ "ID","Name" };
列中LinkButton的CommandName属性设为"Delete"
就可以在GridView1_RowDeleting中写代码:
DataKey key = GridView1.DataKeys[e.RowIndex];
int id = int.Parse(key[0].ToString());//得到id字段值
string name = key[1].ToString();//得到name字段值