MVC model for dynamic survey form step by step
Here is the html:
- @for (int i = 0; i < Model.Questions.Count(); i++)
- {
- class="tab-pane active" id="tab1">
- @for (int k = 0; k < Model.Questions.Count(); k++)
- {
class="row">class="form-group">class="col-md-12">- @*@Html.DisplayFor(model => model.Questions[k].QuestionText)*@
- @*
*@- @for (int j = 0; j < Model.Answers.Take(1).Count(); j++)
- {
- @Html.DisplayFor(model => model.Questions[k].QuestionText)
- @**@
class="mt-checkbox-list">- ="mt-checkbox">
- "checkbox"> @Html.DisplayFor(model => model.Answers[j].AnswerText)
- ="mt-checkbox">
- "checkbox"> @Html.DisplayFor(model => model.Answers[j].AnswerText)
- ="mt-checkbox">
- "checkbox"> @Html.DisplayFor(model => model.Answers[j].AnswerText)
- ="mt-checkbox">
- "checkbox">@Html.DisplayFor(model => model.Answers[j].AnswerText)
- ="mt-checkbox">
- "checkbox"> @Html.DisplayFor(model => model.Answers[j].AnswerText)
- how do i bind the question answer multiple choice in a model and html.
- the above code not working properly.
- I want in tab1 4 questions with multiple choice and tab2 4 questions with multiple choice.
- here is the model:
can ayone guide me how do i create a model and html.so that it will bind question and answer in a survey form respectively in mvc4- public List
Questions { get; set; } - public List
Answers { get; set; } - public class QuestionsModel
- {
- public string QuestionText { get; set; }
- public string QuestionComment { get; set; }
- }
- public class AnswerModel
- {
- public string AnswerText { get; set; }
- public bool IsCorrect { get; set; }
- }
4 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Posted Apr 3, 2017, 8:31 AM
https://www.codeproject.com/Articles/584161/Survey-Web-App-Using-ASP-NET-MVC-Entity-Framewor
https://www.codeproject.com/Articles/486564/ASP-NET-Simple-Survey-Application
http://stackoverflow.com/a/21930525/728750
https://www.twilio.com/docs/tutorials/walkthrough/automated-survey/csharp/mvc
http://highoncoding.com/Articles/645_Creating_Multiple_Choice_Exam_Application_Using_ASP_NET_MVC_Framework.aspx
http://ngalatalla.blogspot.in/2011/11/building-dynamic-quiz-application-in.html
http://20fingers2brains.blogspot.com/2013/05/simple-dynamic-quiz-in-aspnet-mvc3-razor.html
Manoj MaharanaPosted Apr 3, 2017, 3:31 AM
Manoj MaharanaPosted Mar 31, 2017, 10:27 PM
Ramesh PalanivelPosted Mar 31, 2017, 11:46 AM