在 Asp.net 中的 Web 表单上显示多项选择题
在我的项目中,我有一个返回 Exam 对象的 Web 服务。该对象包含一个属性,该属性返回 Questions[] 数组中的多项选择问题集。 Questions 数组中的每个 Question 对象都包含两个属性:Question 和 ChoiceArray。为了清除这里的代码,
Exam e = service.GetExam(long CenterID);
问题[]问题= e.问题;
foreach(问题中的问题)
{
string q = question.Question;
Choice[] choice = question.Choice;
}
我需要知道一种方法,可以将所有这些问题及其选择写入表单。由于我将它们作为数组,因此无法使用 DataList 正确绑定它们。知道如何在表单上和选项选择上显示这些问题及其选择,请获取每个问题所选答案的值。
谢谢。
In my project I have a web service that returns an Exam object. This object contains a property that returns set of multiple choice questions in Questions[] array. Each Question object in Questions array contains two properties, Question and ChoiceArray. To clear things here's the code,
Exam e = service.GetExam(long CenterID);
Questions[] questions = e.Questions;
foreach(Qestion question in questions)
{
string q = question.Question;
Choice[] choice = question.Choice;
}
I need to know a way I can all of these question and their choices onto a form. Since I have these as arrays I can not bind them properly using DataList. Any idea how to display these questions and their choices on to the form and on choice selection, get the value of the selected answer for each question back.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用此方法将数组转换为
List
:http://www.dotnetspider.com/resources/19560-Convert-from-string-array-to-list-t.aspx
然后你可以绑定到 RadioButtonList。
You can use this method to convert the array to a
List<string>
:http://www.dotnetspider.com/resources/19560-Convert-from-string-array-to-list-t.aspx
You can then bind to a RadioButtonList.