Bind Categories in dropdownlist with sitefinity


Programmatically populate DropDownList with Taxonomy Categories,

In the sitefinity sometime you need to bind collection list/Categories into repeater grid or drop down.

Below code snippet will helps you for it

TaxonomyManager manager = TaxonomyManager.GetManager();
var taxonomy = manager.GetTaxonomies<HierarchicalTaxonomy>().Where(t => t.Name == "Categories").SingleOrDefault();
var categoryList = taxonomy.Taxa.ToList();
drpEventTypes.DataSource = categoryList;
drpEventTypes.DataTextField = "Title";
drpEventTypes.DataValueField = "Id";
drpEventTypes.DataBind();
Advertisements

2 Responses to Bind Categories in dropdownlist with sitefinity

  1. I am no longer certain the place you’re getting your info, however good topic.
    I needs to spend some time learning more or figuring out more.
    Thank you for wonderful information I was searching for this info for my mission.

  2. I seriously love your blog.. Pleasant colors & theme.
    Did you make this amazing site yourself?
    Please reply back as I’m planning to create my own personnal site and would like to learn where you
    got tnis from or just what the theme is named. Appreciate it!

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: