private void loadQuestion() { int count = 0; for (int i = 0; i < QuestionList.Items.Count; i++) { if (QuestionList.Items[i].Selected) { count++; } } if (count <= 4) { int idQuestion = 0; string qrDE = "sp_Select_CauHoi_DE"; DataTable table = helper.execQuery(qrDE); foreach (DataRow item in table.Rows) { string a = item[1].ToString(); idQuestion = int.Parse(item[0].ToString()); ViewState["IDQuestion"] = idQuestion; lbQuestion.Text = a; } string qr1 = "sp_Select_DapAn"; string[] pam = { "@idCauHoi" }; object[] ob = { idQuestion }; AnswerList.DataSource = helper.execQuery(qr1, pam, ob); AnswerList.DataTextField = "NoiDungDapAn"; AnswerList.DataValueField = "IDDapAn"; AnswerList.DataBind(); } if (count > 4 && count <= 7) { btnStop.Visible = true; int idQuestion = 0; string qrTB = "sp_Select_CauHoi_TB"; DataTable table = helper.execQuery(qrTB); foreach (DataRow item in table.Rows) { string a = item[1].ToString(); idQuestion = int.Parse(item[0].ToString()); ViewState["IDQuestion"] = idQuestion; lbQuestion.Text = a; } string qr1 = "sp_Select_DapAn"; string[] pam = { "@idCauHoi" }; object[] ob = { idQuestion }; AnswerList.DataSource = helper.execQuery(qr1, pam, ob); AnswerList.DataTextField = "NoiDungDapAn"; AnswerList.DataValueField = "IDDapAn"; AnswerList.DataBind(); } if (count > 7) { int idQuestion = 0; string qrKH = "sp_Select_CauHoi_KHO"; DataTable table = helper.execQuery(qrKH); foreach (DataRow item in table.Rows) { string a = item[1].ToString(); idQuestion = int.Parse(item[0].ToString()); ViewState["IDQuestion"] = idQuestion; lbQuestion.Text = a; } string qr1 = "sp_Select_DapAn"; string[] pam = { "@idCauHoi" }; object[] ob = { idQuestion }; AnswerList.DataSource = helper.execQuery(qr1, pam, ob); AnswerList.DataTextField = "NoiDungDapAn"; AnswerList.DataValueField = "IDDapAn"; AnswerList.DataBind(); } }