Country Region Dropdown

  0 rating
11/13/2013 2:05:46 AM
4/17/2015 1:40:38 PM
Provider: Three Point Turn


This Accelerator provides developers with country and region (state/region) drop down controls that are connected to dictionary nodes in the Sitecore content tree.  

Source code has been included, which makes this a good learning tool for any developers interested in developing their own custom controls for Sitecore.

We'd appreciate your suggestions for improving the functionality for use cases that you may encounter.


  • Documentation > Country Region Developer Guide
    Country Region Developer Guide
    Purpose: This module makes it easier manage countries and regions in Sitecore.

    Installation Instructions:
    1. In the web.config search <pages and add the following line in the web.config

      <add tagprefix="sc" namespace="Sitecore.SharedSource.CountryRegion.UI.WebControls" assembly="Sitecore.SharedSource.CountryRegion" />

      <add tagprefix="sc" namespace="Sitecore.SharedSource.CountryRegion.UI.WebControls" assembly="Sitecore.SharedSource.CountryRegion" />

    2. Upload the packages in the packages folder to your sitecore instance in order by number.  If you need instructions on uploading a package please read the article on SitecoreGuild.

      The first package is simply a data package with the countries and regions under the lookup folder.

      The second package contains the dll and a sample sublayout under /sitecore/sublayouts/3pt/sharedsource/countryregion

    3. Log in to the Sitecore Admin and open the content editor.  In the content tree you will see a new folder: Lookups.  Under this folder will be a list of countries with regions specified for Canada and United States.  You can add your own regions for other countries or edit the existing ones as necessary. I have NOT added multiple language versions for the countries in this version.

    4. If you click on a page and choose presentation -> details you can add the sample sublayout to the page. This sample sublayout can be found under /sitecore/sublayouts/3pt/sharedsource/countryregion

    5. Take a look at the ascx file and you will see how the front end is wired up.  Note that the countrydropdownlist does all the work.  I gets assigned the id of the regions dropdown list and will perform the databind on index change.  If you needed to incorporate a city dropdown you could do the same using by adding a property to the regions dropdown and then perform a similar onselectedindexchange event to fill the city list.

    If you have any questions, suggestions or need assistance using this module please email or
Release notes
v1. No known issues
Read more Back
Code examples
  • Code examples > Country Drop Down List
    Country Drop Down List
    using System;
    using System.Collections.Generic;
    using System.Text;

    using System.Web.UI;
    using System.Web.UI.WebControls;

    namespace Sitecore.SharedSource.CountryRegion.WebControls
        /// <summary>
        /// Country Drop Down List
        /// </summary>
        public class CountryDropDownList : DropDownList
            /// <summary>
            /// ID of Region DropDownlist
            /// </summary>
            public string RegionDropDownListId { get; set; }

            protected override void OnInit(EventArgs e)

                DataSource = CountryRegionUtils.GetCountries();
                DataValueField = "Key";
                DataTextField = "Phrase";

                // Ensure autopostback is true so it will trigger the selected index change.
                AutoPostBack = true;
                this.SelectedIndexChanged += CountryDropDownList_SelectedIndexChanged;

            void CountryDropDownList_SelectedIndexChanged(object sender, EventArgs e)
                if (string.IsNullOrEmpty(RegionDropDownListId) == false)
                    DropDownList ddlRegion = FindControlRecursive(this.Page, RegionDropDownListId) as DropDownList;
                    if (ddlRegion != null)
                        ddlRegion.DataSource = CountryRegionUtils.GetRegions(SelectedValue);
                        ddlRegion.DataValueField = "Key";
                        ddlRegion.DataTextField = "Phrase";

            /// <summary>
            /// Recursively searches for a server control with the given ID.
            /// </summary>
            /// <param name="id">ID of control to find</param>
            /// <returns>The matching control or null if no match was found</returns>
            public static Control FindControlRecursive(Control control, string id)
                foreach (Control ctl in control.Controls)
                    if (ctl.ID == id)
                        return ctl;

                    Control child = FindControlRecursive(ctl, id);
                    if (child != null)
                        return child;
                return null;


Solution screenshots(0)


Reviews (0)

Sort by: Date Most votes
  • Profile Avatar

    Level: 0

    x0 x0 x0




    Was this helpful?


Comments (0)

Sort by: Date  Most votes

Leave a Comment

Comment must be field in
Post comment

Write a review

Title can't be empty
Review can't be empty
Post review


Title Description Download Action

Add File