protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Request.QueryString["Id"] != null) { Edit(); } } } protected void Edit() { int id = Convert.ToInt32(Request.QueryString["Id"].ToString()); DataTable dt1 = s.GetAccessRightsByRole(id.ToString()); if (dt1.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { if (dt1.Rows[i]["RightId"].ToString() == "1") { CheckBoxList1.Items[0].Selected = true; } if (dt1.Rows[i]["RightId"].ToString() == "2") { CheckBoxList1.Items[1].Selected = true; } if (dt1.Rows[i]["RightId"].ToString() == "3") { CheckBoxList1.Items[2].Selected = true; } if (dt1.Rows[i]["RightId"].ToString() == "4") { CheckBoxList1.Items[3].Selected = true; } if (dt1.Rows[i]["RightId"].ToString() == "5") { CheckBoxList1.Items[4].Selected = true; } if (dt1.Rows[i]["RightId"].ToString() == "6") { CheckBoxList1.Items[5].Selected = true; } if (dt1.Rows[i]["RightId"].ToString() == "7") { CheckBoxList1.Items[6].Selected = true; } if (dt1.Rows[i]["RightId"].ToString() == "8") { CheckBoxList1.Items[7].Selected = true; } if (dt1.Rows[i]["RightId"].ToString() == "9") { CheckBoxList1.Items[8].Selected = true; } } if (dt1.Rows.Count == 0) { for (int i = 0; i < CheckBoxList1.Items.Count; i++) { CheckBoxList1.Items[i].Selected = false; } } } }
for (int i = 0; i < dt.Rows.Count; i++)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)