后台页面的代码:
//第二列
td = new TableCell();
td.Width = 620;
td.HorizontalAlign = HorizontalAlign.Left;
//判断题型
if (temp.T_ExeTestType == 1)
{
//该题为选择题
td.Controls.Add(new LiteralControl("<div style='margin-left:10px'>"+
"<input name=" +temp.T_ExeTestID + " type='radio' value='A' />" + "A、"+temp.T_ChoiceA +
"<br />" +
"<input name=" + temp.T_ExeTestID + " type='radio' value='B' />" + "B、"+temp.T_ChoiceB +
"<br />" +
"<input name=" + temp.T_ExeTestID + " type='radio' value='C' />" + "C、" + temp.T_ChoiceC +
"<br />" +
"<input name=" + temp.T_ExeTestID + " type='radio' value='D' />" + "D、" + temp.T_ChoiceD +
"<br /></div>"));
}
else if (temp.T_ExeTestType == 2)
{
//该题为判断题
td.Controls.Add(new LiteralControl("<div style='margin-left:10px'><input name=" +
temp.T_ExeTestID + " type='radio' value='A' />" + "对" +
"<br />"+
"<input name=" + temp.T_ExeTestID + " type='radio' value='B' />" + "错" +
"<br /></div>")); }
tr.Cells.Add(td);
//第三列
td = new TableCell();
td.Width = 100;
td.HorizontalAlign = HorizontalAlign.Center;
tr.Cells.Add(td);
//添加新行
Exercise_List.Rows.Add(tr); }
前台还有个button按钮,我想按button按钮就把用户提交的答案存到数据库,但是不知道怎么获取用户选择了那个选项。刚学C#,大家多指教!inputbuttonradioc#
//第二列
td = new TableCell();
td.Width = 620;
td.HorizontalAlign = HorizontalAlign.Left;
//判断题型
if (temp.T_ExeTestType == 1)
{
//该题为选择题
td.Controls.Add(new LiteralControl("<div style='margin-left:10px'>"+
"<input name=" +temp.T_ExeTestID + " type='radio' value='A' />" + "A、"+temp.T_ChoiceA +
"<br />" +
"<input name=" + temp.T_ExeTestID + " type='radio' value='B' />" + "B、"+temp.T_ChoiceB +
"<br />" +
"<input name=" + temp.T_ExeTestID + " type='radio' value='C' />" + "C、" + temp.T_ChoiceC +
"<br />" +
"<input name=" + temp.T_ExeTestID + " type='radio' value='D' />" + "D、" + temp.T_ChoiceD +
"<br /></div>"));
}
else if (temp.T_ExeTestType == 2)
{
//该题为判断题
td.Controls.Add(new LiteralControl("<div style='margin-left:10px'><input name=" +
temp.T_ExeTestID + " type='radio' value='A' />" + "对" +
"<br />"+
"<input name=" + temp.T_ExeTestID + " type='radio' value='B' />" + "错" +
"<br /></div>")); }
tr.Cells.Add(td);
//第三列
td = new TableCell();
td.Width = 100;
td.HorizontalAlign = HorizontalAlign.Center;
tr.Cells.Add(td);
//添加新行
Exercise_List.Rows.Add(tr); }
前台还有个button按钮,我想按button按钮就把用户提交的答案存到数据库,但是不知道怎么获取用户选择了那个选项。刚学C#,大家多指教!inputbuttonradioc#
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货