[RESOLVED]Dynamic Questionnaire in ASP.Net MVC 4.0

I have a requirement to implement a dynamic questionnaire (i.e, question populates based on the user response for previous question)  functionality in my ASP.Net MVC 4 web application. Can anyone provide some pointers for reference to get more idea to implement
this functionality. Thanks in advance.

Hi saravanan289,

Thanks for your post.

 I would imagine you would probably want to take advantage of Display / EditorTemplates. You would define an interface IQuestion

or something, and then have a bunch of different form options that implement that interface. So your model would have a List<IQuestion>, and then for each question in the list, Html.EditorFor(item) or so.Then some kind of standardized way of storing the
answers into a table (perhaps a unique save / load method on IQuestion. You could define the questions via DB and then your models could have varying counts (and elements) in the List<IQuestion>. Just run a DB script (or some kind of admin page) and you could
dynamically change the form displayed.

There are some references:

#MVC model for dynamic survey form

http://stackoverflow.com/questions/21930154/mvc-model-for-dynamic-survey-form

#Building a  dynamic quiz application in ASP.net MVC

http://ngalatalla.blogspot.com/2011/11/building-dynamic-quiz-application-in.html

#Simple Dynamic Quiz in Asp.net MVC3 Razor

http://20fingers2brains.blogspot.com/2013/05/simple-dynamic-quiz-in-aspnet-mvc3-razor.html

Hope this can be helpful.

Best Regards,

Eileen

Leave a Reply