Atlas CascadingDropDown Extender

Cristian Merighi () 4.00

An exhaustive example about Microsoft AJAX Control Toolkit (Atlas) CascadingDropDown Extender, applied to three hierarchically related dropdownlists. WebForm, C# WebService Code, Database and Live Demo provided!
This article is obsolete. Some functionalities might not work anymore. Comments are disabled.

With this article I try to give a complete and working example about how to exploit Microsoft AJAX Control Toolkit (looking forward) CascadingDropDown (CDD) Extender, using as usual a real world scenario.

The piece of coding I'm about to show has been realized for the infrastructures web management tool engineered by C.I.E.R.I.V. for Emilia-Romagna Region Board.
The goal is to ease the choice of a Commune stepping through the hierarchy from Regions to Provinces til Communes.
Needed objects are:

  1. a DataBase containing properly related elements (in this case a SQL Server DataBase);
  2. a WebForm bringing the GUI (user interface) (3 dropdownlists, 1 CDD Extender);
  3. a WebService which acts as a proxy for data retrieving.

Here you can find the three element (zipped) combining the working example, no business logic classes but straight queries to an .mdb database.

mdb file « download .zip file

The application is 3-tier layered one: Data access (DAL), Business Logic (BLL) and Presentation Layer. There are therefore classes for Regions, Provinces and Communes whose diagrams are reported below:

Class diagram

(This discussion isn't about the structure of the application, so I won't say about this aspect. It's helpful for me to mention it to justify portions of code that you'll see next..

WebForm code, please pay attention to properties Category, ServiceMethod and ParentControlID:

    <!-- omitted code... -->

            <asp:DropDownList runat="server" 
            ID="ddlRegion" />
            <!-- atlas control toolkit is registered with "atlas" prefix -->
            <atlas:CascadingDropDown runat="server" ID="cddIstat">
                <atlas:CascadingDropDownProperties Category="Region"
                ServiceMethod="GetIstat" ServicePath="~/Services/Istat.asmx"
                TargetControlID="ddlRegion" LoadingText="loading regions..." 
                PromptText="- select regione -" /> 
                <atlas:CascadingDropDownProperties Category="Province" 
                ServiceMethod="GetIstat" ServicePath="~/Services/Istat.asmx" 
                TargetControlID="ddlProvince" LoadingText="loading provinces..." 
                PromptText="- select province -" />
                <atlas:CascadingDropDownProperties Category="Commune" 
                ServiceMethod="GetIstat" ServicePath="~/Services/Istat.asmx"
                TargetControlID="ddlCommune" LoadingText="loading communes..." 
                PromptText="- select commune -" />
        <br />
            <asp:DropDownList runat="server" ID="ddlProvince" />
        <br />
            <asp:DropDownList runat="server" ID="ddlCommune" />

WebService object code:

<%@ WebService Language="C#" Class="Istat" %>

using System;
using System.Collections.Specialized;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using AtlasControlToolkit;
using Cieriv.BLL;

[WebService(Namespace = "")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Istat  : System.Web.Services.WebService {

    // The called method must have the following signature (parameters included!)
    public CascadingDropDownNameValue[] GetIstat(
       string knownCategoryValues, string category)
        CascadingDropDownNameValue[] ret = null;
        int j = 0;
            Important: using the utility method ParseKnownCategoryValuesString 
            to parse what comes from the GUI...
            - see image below -
        StringDictionary kv = 
        switch (category.ToLower())
            case "region":
                // using BLL objects to retrieve a collection of Regions
                RegionCollection regions = 
                ret = new CascadingDropDownNameValue[regions.Count];
                foreach (Region reg in regions)
                    ret[j] = new CascadingDropDownNameValue(reg.Name, reg.IstatCode);
            case "province":
                ProvinceCollection provinces = 
                ret = new CascadingDropDownNameValue[provinces.Count];
                foreach (Province prov in provinces)
                    ret[j] = new CascadingDropDownNameValue(
                    string.Format("{0} - istat: {1}", prov.Name, prov.IstatCode), 
            case "commune":
                CommuneCollection communes = 
                ret = new CascadingDropDownNameValue[communes.Count];
                foreach (Commune com in communes)
                    ret[j] = new CascadingDropDownNameValue(
                    string.Format("{0} - istat: {1}", com.Name, com.IstatCode), 
        return ret;

WHy you should use ParseKnownCategoryValuesString utility method, please note the format "{category}:{value};" of the knownCategoryValues parameter:

What knownCategoryValues contains (string to parse)

Working demo:


That's it.

Take care. Bye.


  • Re: Atlas CascadingDropDown Extender

    dana Monday, October 23, 2006 4.00

    hi, I'm new in ajax/atlas and I tried to customize your sample ...but I get an error and i have no idea what should I do:( this is my error: Extender controls require a ScriptManager to be present on the page. Parameter name: scriptManager... can you help me ..thanks

  • Re: Atlas CascadingDropDown Extender

    CMerighi Monday, October 23, 2006 0.00

    ...sure I can! I've updated my article: now you can download a minimal - working - version of the described example. Regarding the ScriptManager, just remember that it is the CORE of your ASP.NET AJAX app. You just have to put it on your AJAX enhanced page! The reference on the official site will give you deeper infos. Hope it helped...




Cristian Merighi facebook twitter google+ youtube

Latest articles

Top rated


Where am I?


Cristian Merighi facebook twitter google+ youtube

I'm now reading