나는 다음과 같은 멤버와 DTO를 만들었습니다MVC에서 라디오 버튼의 선택 값을 가져
public List<Guid> QuestionIds { get; set; }
public List<Guid> AnswerIds { get; set; }
public CompetitionDTO Competition { get; set; }
내가 질문 목록은 사용자에 대한 표시하고 올바른을 선택할 수 있도록 몇 가지 답변을 들어 표시 싶어요 그/그녀가 확신하는 어떤 질문에 대한 대답. 나는이 기록 된 면도칼보기에 지금
public class QuestionDTO
{
public Guid Id { get; set; }
public string Title { get; set; }
public string Category { get; set; }
public IList<AnswerDTO> Answers { get; set; }
}
public class AnswerDTO
{
public Guid Id { get; set; }
public int Order { get; set; }
public string Title { get; set; }
}
:
@for (var i = 0; i < Model.Competition.Questions.Count; i++)
{
@Html.DisplayTextFor(x => x.Competition.Questions[i].Title)
foreach (var t in Model.Competition.Questions[i].Answers)
{
@Html.DisplayFor(c => t.Title)
@Html.RadioButtonFor(x => x.Competition.Questions[i].Answers, false, new { Model = t.Id })
}
}
을하지만 데이터를 전달할 때 작동하지 않습니다
public class CompetitionDTO
{
public Guid Id { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
public IList<QuestionDTO> Questions { get; set; }
}
과 QuestionDTO : CompetitionDTO는 다음과 같은 스타일을 가지고 행동을 게시하려면, 내가 선택한 모든 답변을 자신의 질문과 함께 갖고 싶습니다. 어떻게 해결해야합니까? 감사합니다
이 이미 응답되었습니다. http://stackoverflow.com/questions/19964553/mvc-form-not-able-to-post-list-of-objects –