Hi, I've got a Dictionary<string, string> object I'm creating:-
Dictionary<string, string> locationList = new Dictionary<string, string> { { "A", "AAA" }, { "B", "BBB" }, { "C", "CCC" } };
and I wanted to bind this to a dropdownlist. I know this is possible in code-behind, but is it possible to do this directly on the asp: control, something like:-
<asp:DropDownList ID="DropDownList1" runat="server" DataSource="locationList" DataTextField="Key" DataValueField="Value">
I've seen various options, for example DataSource='<%#locationList.Values %>' , but can't get any of them to work and most solutions seem to fall back to codebehind. For various reasons I'd rather not have to do it in codebehind, one being the simplicity/neatness of being able to do this in the asp: tag rather than having to have 2 "sections" of code. Is this possible, or do I have to ...
Go to the complete details ...