【发布时间】:2016-07-09 16:16:49
【问题描述】:
我有一个测验表格,它显示了一些问题及其答案(单选按钮), 用户必须回答问题并发送, 我做了一些这样的课:
public class Question
{
public int Qid { get; set; }
public string Questionstext { get; set; }
public int selected { get; set; }
public List<Qitem> lst { get; set; }
}
public class Qitem
{
public int id { get; set; }
public string txt { get; set; }
}
然后我将问题列表发送到视图中:
List<Question> llst = new List<Question>
{
new Question
{
Qid = 1,
Questionstext = "is it true?",
lst = new List<Qitem>
{
new Qitem
{
txt = "yes",
id = 1
},
new Qitem
{
id = 2,
txt = "no"
}
}
},
new Question
{
Qid = 1,
Questionstext = "is it true 2?",
lst = new List<Qitem>
{
new Qitem
{
txt = "yes2",
id = 3
},
new Qitem
{
id = 4,
txt = "yes3"
}
}
}
};
return View(llst);
我怎样才能显示它然后提交答案, 答案必须放在问题的“选定”属性中。 我的问题是关于视图和特别是单选按钮。
【问题讨论】:
标签: c# asp.net-mvc radio-button