asp.net - Can you bind an object containing a Dictionary Property to a dropdownlist? -



asp.net - Can you bind an object containing a Dictionary Property to a dropdownlist? -

for example, have instance of next class declaration:

public class person { public string name = ""; public dictionary<string, string> properties = new dictionary<string, string>(); }

and have list of person wish bind asp.net drop downwards list.

list<person> people = new list<person>(); //fill list etc.. //bind drop downwards list ddlpeople.datasource = people; ddlpeople.datatextfield = "name"; ddlpeople.datatextfield = "properties['age']"; //this like!

age present. not have command of person class. know if trying achievable?

thanks!

as far know, can not that.

i guess go :

ddlpeople.items.clear(); ddlpeople.items.addrange(people.select(p => new listitem(p.name, p.properties["age"])).toarray());

but not sure point of question.

asp.net data-binding

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -