protected void Page_Load(object sender, EventArgs e) { function.AccessRulo(); if (!IsPostBack) { int id = DataConverter.CLng(Request.QueryString["id"]); if (id > 0) { liQuestionType.Text = "修改题型"; Label1.Text = "修改题型"; hftid.Value = id.ToString(); M_Exam_Type mqt = bqt.GetSelectById(id); txt_name.Text = mqt.t_name; txtRemark.Text = mqt.t_remark; ddType.SelectedValue = mqt.t_type.ToString(); } else { liQuestionType.Text = "添加题型"; Label1.Text = "添加题型"; } Call.SetBreadCrumb(Master, "<li><a href='" + CustomerPageAction.customPath2 + "I/Main.aspx'>工作台</a></li> <li><a href='Papers_System_Manage.aspx'>教育模块</a></li> <li><a href='QuestionManage.aspx'>考试管理</a></li> <li><a href='QuestionTypeManage.aspx'>题型管理</a></li><li>修改题型</li>"); } }
/// <summary> /// 试题题型选择:页面显示 /// </summary> private void option() { string option = hfoption.Value; string answer = hfanw.Value; int type = DataConverter.CLng(ddlType.SelectedValue); string[] str = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J" }; M_Exam_Type mqt = bqt.GetSelectById(type); int num = DataConverter.CLng(ddlNumber1.SelectedValue); string[] options = option.Split(','); string[] answers = answer.Split(','); string opt = ""; string anws = ""; //单选,多选,判断,填空,问答,组合 switch (mqt.t_type) { case 1: //单选 ddlNumber1.Visible = true; Tips.Visible = true; optionDiv.Visible = true; anwDiv.Visible = true; optionDiv.InnerHtml = ""; anwDiv.InnerHtml = ""; Tips.Text += "<font color='red'> 注意:以下信息请不要输入','(逗号)</font>"; for (int i = 0; i < num; i++) { if (i < options.Length) { opt = options[i]; } else { opt = ""; } optionDiv.InnerHtml += str[i] + ": <textarea name='option' id='option" + i + "' style='width:400px;height:43px'>" + opt + "</textarea><br/>"; if (str[i] == answer) { anws = "checked='checked'"; } else { anws = ""; } anwDiv.InnerHtml += str[i] + "<input type='radio' id='anw" + i + "' name='anws' value='" + str[i] + "' " + anws + " />"; } break; case 2: //多选 ddlNumber1.Visible = true; Tips.Visible = true; Tips.Text += "<font color='red'> 注意:以下信息请不要输入','(逗号)</font>"; optionDiv.Visible = true; anwDiv.Visible = true; optionDiv.InnerHtml = ""; anwDiv.InnerHtml = ""; for (int i = 0; i < num; i++) { if (i < options.Length) { opt = options[i]; } else { opt = ""; } optionDiv.InnerHtml += str[i] + ": <textarea name='option' id='option" + i + "' style='width:400px;height:43px' >" + opt + "</textarea><br/>"; if (answer.IndexOf(str[i]) > -1) { anws = "checked='checked'"; } else { anws = ""; } anwDiv.InnerHtml += str[i] + "<input type='checkbox' id='anw" + i + "' name='anws' value='" + str[i] + "' " + anws + "/> "; } break; case 3: //判段 ddlNumber1.Visible = false; Tips.Visible = false; optionDiv.Visible = false; anwDiv.Visible = true; if (answer == "0") { anwDiv.InnerHtml = "<input type='radio' id='anw1' name='anws' value='0' checked='checked'/>错误 <input type='radio' id='anw2' name='anws' value='1' />正确 "; } else { anwDiv.InnerHtml = "<input type='radio' id='anw1' name='anws' value='0' />错误 <input type='radio' id='anw2' name='anws' value='1' checked='checked' />正确 "; } break; default: break; } }