How can I DataBind a List<> of objects to a DropDownList and set the SelectedItem based on a property in the object?

How can I DataBind a List<> of objects to a DropDownList and set the SelectedItem based on a property in the object?

For example, say I have a List

Where Person has 3 properties...

Person .Name (string)
       .Id  (int)
       .Selected (bool)

I want the first one with Selected == true to be the SelectedItem in the list.

12
задан user135799 5 May 2011 в 21:24
поделиться