#region 得到前臺的ID public string getId() { string str_id = null; int rowCount = post_gv.Rows.Count; //獲取前臺gridview行數(shù) for (int i = 0; i < rowCount; i++) //每一行進行循環(huán)遍歷,如果勾選則得到ID,否則不獲取 { CheckBox check = (CheckBox)post_gv.Rows[i].FindControl("selOne"); if (check.Checked == true) { int id = 0;
id = Convert.ToInt32(post_gv.DataKeys[i].Value); //循環(huán)遍歷ID后放在字符串里,用逗號分隔,方便拆分用戶,這里注意,拆分時忽略第一個值,因為此格式為 :