I have a survey form. The questions and options are generated from the database. There are 5 questions in the form, each are generated using the partial view.
The question is a partial view and the options are templated view.
The problem is when submitting the form and the user did not select an answer, it will show a validationsummary
. The problem is the selected answers are gone.
Partial View
<% for(var x = 0; x < Model.QuestionOptions.Count(); x++){%>
<% var option = Model.QuestionOptions.ToList()[x]; %>
<li>
<%: Html.EditorFor(model => option, "RadioButton")%>
</li>
<% } %>
radio button template
<%: Html.RadioButton("OptionId", Model.OptionId, false)%>