Drop downs values pulled from EpiServer

I am pretty new in EpiServer, but here is my attempt to fill some drop down lists with data coming from the CMS. I am using a version 6 of EpiServer since this is the one I needed to work on when I made these changes.

I had a form with some drop down lists which its content was hard-coded. I was asked to pull the data from the CMS:Job Function DropDownList

First, I created a new folder for each of these drop downs where inside I added all the options I wanted to display with its correspondent page type. Continuing with the example, the content tree looked something like:

EpiServer Job Functions

I created a page type to handle all the options I wanted to add in the drop down list. The page type can be really simple to only have one field for the name or more complex to handle a checkbox to make each option visible or not, etc.

Page type - job function

Then, this is what I made to read the values from the CMS:

public static List GetJobFunctions()
 var criteria = new PropertyCriteriaCollection();
 var jobFunctions = new PropertyCriteria
 Type = PropertyDataType.PageType,
 Value = "98",
 Condition = CompareCondition.Equal,
 Required = true,
 Name = "PageTypeID"
return DataFactory.Instance.FindPagesWithCriteria(Constants.Pages.JobFunctionsFolder.PageLink, criteria).AsTyped().ToList();

Obviously, there will be more ways to do the same thing. However, I am pretty new to EpiServer and I didn’t find something to help me when I needed to do this; so, this is my approach with the intention to give ideas to other people who want to do the same in the future.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.