The text member is "value" and the value member is "key" when using one of these types of objects to bind to a DropdownList.
Dictionary<byte> dicTable = new Dictionary<byte>(); dicTable.Add(1, "One"); dicTable.Add(2, "Two"); dicTable.Add(3, "Three"); dicTable.Add(4, "Four"); cmbDropDownList.DataSource = dicTable; cmbDropDownList.DataTextField = "Value"; cmbDropDownList.DataValueField = "Key"; cmbDropDownList.DataBind();
No comments:
Post a Comment