내 질문에 대해 RadioButtonFor 또는 CheckBoxFor를 만들려고합니다. 내보기에서asp.net에서 RadioButtonFor는 하나의 라디오 버튼 만 만듭니다.
public class Question { public int ID { get; set; } public string Question1 { get; set; } } public class Answer { public int ID { get; set; } public string Answer1 { get; set; } public int QId { get; set; } } public class AnModelView { public Answer Answers { get; set; } public IQueryable<Question> Questions { get; set; } }
내가이 노력하고 있어요 : :이 모델 생성
<%:Html.RadioButtonFor(model => model.Answers.QId, new SelectList(Model.Questions.Select(qu => new RadioButtonList { DataValueField = qu.ID.ToString(), DataTextField = qu.Question1 }), "Value", "Text"))%>
을하지만, 출력은 하나의 라디오 버튼입니다. 여러 개의 라디오 버튼을 얻는 방법 - 각 답변에 하나씩
u 여기에서 radioibuttonlist 도우미를 사용할 수 있습니다. http://awesome.codeplex.com – Omu