pandaranol
New Member
I want to bind a dictionary to DropDownList. But before bindingI want to sort it alphabetically - either by key or value.How can I obtain that? Is there some kind of build in sortfunction or a trick?Here is my code: \[code\] Dim Dic1 As New Dictionary(Of String, String) Dic1.Add("1", "pear") Dic1.Add("2", "apple") Dic1.Add("3", "juice") Dic1.Add("4", "milk") Dic1.Add("5", "cornflakes") drpProduct.DataSource = Dic1 drpProduct.DataTextField = "Value" drpProduct.DataValueField = "Key" drpProduct.DataBind()\[/code\]Thanks in advance,Best regards.