NameValuePair and DropdownListsNameValuePair and DropdownLists
Old forum URL: forums.lhotka.net/forums/t/3017.aspx
Gareth posted on Monday, June 11, 2007
I've been trying to work out the best way to add a blank (empty string) value to a dropdownlist that is bound to a collection of NameValuePairs. Has anyone got any recommended methods? I want to do this in the presentation layer so I'm guessing I need to hook up to an event after the ddl has been databound.
Thanks,
Gareth.
Brian Criswell replied on Monday, June 11, 2007
I do not know if the ObjectListView works with NameValueList, but it does have an IncludeDefault property that lets you set the values of an item at index 0.
McManus replied on Monday, June 11, 2007
Gareth,
We use the HeaderedBindingList for this. It's posted by tetranz (see: http://forums.lhotka.net/forums/post/4690.aspx ).
In the business layer, we define a static Empty property, representing an empty NameValuePair. This instance is put in the HeaderedBindingList as the first empty item.
Cheers,
Herman
Gareth replied on Tuesday, June 12, 2007
Herman, that's exactly what I needed. Thank you!
Regards,
Gareth.
Copyright (c) Marimer LLC