如果不創建額外的類,我想將一個asp.net DropDown控件綁定到Dictionary<char,string>
的集合。可能嗎? 你能提醒一下嗎?以下是我試過的代碼。如何將下拉列表綁定到類型爲Dictionary <char,string>的數據源?
public void FillStatusOptions(Dictionary<char, string> avalibaleStausDictionary)
{
ddlStatus.DataSource = avalibaleStausDictionary;
//TODO: Point to current avalibaleStausDictionary.Key ?
ddlStatus.DataValueField = ... ?
//TODO: HPoint to current avalibaleStausDictionary.Value ?
ddlStatus.DataTextField = ... ?
}