Cascading DropDownList Custom Field Control
May 28th, 2008 . by <Patrick/>After reading the DataCogs article on Sharepoint – Cascading Drop Down Lists I was inspired to take the challenge and modify the code to allow for an infinite number of cascading drop downs. I learned alot from the article, and I would highly reccomend anyone trying to create their own custom fields in Sharepoint to read it. The current code has a parent child relationship however you cannot include a grandchild dropdown.
In my humble solution, I have a drop down of continents, then a related drop down for countries and then a third dropdown with the related cities.

I created three lists:
Continents

Countries

Cities

Then I created a new list where I add the three custom field type Cascading DropDown Fields to the list



I added three new fields to the Cascading DropDown List Details section.
Name - the name of the field this should be a unique name to identify the field
Parent Name - name of the parent DropDown list control if there is one
Child Name - name of the child DropDown list control if there is one
The first custom field I added was the Continent and named it MyContinent for a
lack of a better name and I set the child to be MyCountry
The second custom field I added was the Country and named it MyCountry and added
MyContinent as the parent and MyCity as the child
The third custome field I added was the City and named it MyCity and added MyCountry
as the parent and left the child blank
Once my list was configured, I was on my way to the races.
The code available for download below is part of a Sharepoint solution.
In order to install it on your Sharepoint installation open up a command prompt,
navigate to the Solution folder wherever you unzipped the code to and run the Install.bat
file. I have also included an Uninstall.bat file. I haven’t quite had enough
time yet to get it to work as a feature but I plan to in the weeks ahead. Before running the solution make sure you have the makecab.exe utility. The Microsoft Cabinet Software Development Kit can be downloaded here.
For references on how to package up solutions the following are good articles to read:
Scot Hillier’s What’s Your Process for Developing SharePoint Features and Solutions?


