Quantcast
Channel: Building an online survey with MVC
Viewing all articles
Browse latest Browse all 2

Re: Building an online survey with MVC

$
0
0

You can build your table for Questions in database as 

Question(id, questiontext)

Now  in your model folder, you can create a model for this table (i.e. a class with 2 properties, ID and Text). Each object of this class will represent a single question. 

Then in your controller you can define an action method which will fetch all the questions from database as a List of the Question objects.

You can then pass on this list to a strongly typed view. In the View you only need to iterate the list to display the questions.

This is just a bare approach which I think can help resolve your issue. Depending on your application arhcitecture, you may need to tweak this a little.

Hope this helps... Smile

 

 

 


Viewing all articles
Browse latest Browse all 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>