SaaS CMS has officially launched! Learn more now.

auto populate dropdown from the database



I have to create a page which lists 4 dropdowns and a body text.

First dropdown should get populated with the values from a database table. Based on the selections(single or multiple) in the first dropdown, second dropdown should get populated with the another database table taking the input parameters from the first dropdown, similary for 3rd and 4th. 

Body text should appear with the selected values and some other text.

I want to know how do we populate the dropdowns with the database values. Could anyone please help. Do we have any sample example?

Feb 22, 2016 17:22

This is really a.NET question but normally you have some kind of ORM mapper like Entity Framework to read values from database. Then you extend the view model with the data you need. Check out alloy site where they have a few examples. Fill the view model in controller with the help of your ORM repository classes. Render them in view using the standard razor syntax. See example code plus alloy example site for Episerver.

Feb 22, 2016 17:50

If you are looking into doing this in edit mode (if dojo part is your problem), take a look into this post:

Mar 18, 2016 17:33
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.