Hey,
I have a dictionary object <string, string>
and would like to bind it to a repeater. However, I'm not sure what to put in the aspx
markup to actually display the key-value pair. There are no errors thrown and I can get it to work with a List
. How do I get a dictionary to display in a repeater?
Thanks
Answer: I used this code in the markup to display the key and value individually:
<%# DataBinder.Eval((System.Collections.Generic.KeyValuePair<string, string>)Container.DataItem,"Key") %>
<%# DataBinder.Eval((System.Collections.Generic.KeyValuePair<string, string>)Container.DataItem,"Value") %>