我不知道这是可能的,但是,我有一个复杂类型的字典,我想将其绑定到RadioButtonList的/ CheckBoxList控件:绑定字典单选按钮列表
public class ComplexType
{
public String Name { get; set; }
public String FormattedName { get; set; }
public String Description { get; set; }
}
var listOfMyTypes = new Dictionary<int, ComplexType>();
var myType = new ComplexType { Name = "Name", Description = "Description", FormattedName = "Name|Description" };
var myType1 = new ComplexType { Name = "Name2", Description = "Description2", FormattedName = "Name|Description2" };
listOfMyTypes.Add(1, myType);
listOfMyTypes.Add(2, myType1);
m_dropDownlist.DataTextField = "Value"; //What do I put here to render "Name"
m_dropDownlist.DataValueField = "Key";
m_dropDownlist.DataSource = listOfMyTypes;
m_dropDownlist.DataBind();
这正是我想要的,只需要第二双眼睛。谢谢! –