[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


#Building a  dynamic quiz application in ASP.net MVC


#Simple Dynamic Quiz in Asp.net MVC3 Razor


Hope this can be helpful.

Best Regards,


Leave a Reply