You can populate a dropdownlist in asp.net .NET framework 2.0 this way:
GeSHi (csharp):
Dictionary<int, string> getData= v.returnDictionaryMethod();
DropDownListData.DataTextField = "Value";
DropDownListData.DataValueField = "Key";
DropDownListData.DataSource = getData;
DropDownListData.DataBind();
//The returnDictionary method looks like this:
public Dictionary<int, string> returnDictionary ()
{
Dictionary<int, string> d =
new Dictionary<int, string>
();
//fill the dictionary with data from an sql database or another source here
return d;
}
Created by GeSHI 1.0.7.20