DataRow dr = dt.Rows.Find(gv.DataKeys[e.RowIndex]["id"].ToString()); dr["flag"] = "0";
Linq
IEnumerable<DataRow> q = from dr in dt.AsEnumerable() where dr.Field<int>("id").ToString() == gv.DataKeys[i]["id"].ToString() select dr; foreach (DataRow dr in q) dr["flag"] = "0";
Lambda
IEnumerable<DataRow> q = dt.AsEnumerable().Where<DataRow>(r => (r.Field<int>("id").ToString() == gv.DataKeys[e.RowIndex]["id"].ToString())); foreach (DataRow dr in q) dr["flag"] = "0";
匿名方法
IEnumerable<DataRow> q = dt.AsEnumerable().Where<DataRow>(delegate(DataRow r) { return r["id"].ToString() == gv.DataKeys[i]["id"].ToString(); }); foreach (DataRow dr in q) dr["flag"] = "0";