Hi,
you have just to add the statenames/cities in the corresponding order into the
DropDownList
. Initially you better store them in the Dictionary with Key (statename) and Value (list of cities). Once done, iterate over the dictionary and add the corresponding items.
Dictionary<string,>> dictionary = new Dictionary<String, List<String>>();
dictionary.Add("Statename1", new List<string>(new [] {"city1", "city2"}));
foreach(var pair in dictionary)
{
dropdownlist.Items.Add(pair.Key);
foreach(var city in pair.Value)
{
dropdownlist.Items.Add(city);
}
}
</string>
Regards