我有一个多项选择题的对象列表。我需要使用对象属性创建一个 RadioButtonList:Choice_A、Choice_B、... Choice_D。
var qs = (from questions in dc.Survey_Questions
where questions.Survey_ID == surveyid
select new SQuestions
{
QuestionID = questions.Question_ID,
SurveyID = questions.Survey_ID,
Description = questions.Description,
Choice_A = questions.Choice_A,
Choice_B = questions.Choice_B,
Choice_C = questions.Choice_C,
Choice_D = questions.Choice_D,
}).ToList();
DataList dtQuestion.DataSource = qs;
HTML结构:
<asp:DataList ID="dtQuestion" runat="server" RepeatDirection="Vertical" >`
<ItemTemplate>
<%# Eval("Description") %> `
<ItemTemplate>
<RadioButtonList></RadiobuttonList>
</ItemTemplate>
</ItemTemplate>
</asp:DataList>