Geeks With Blogs
CodeSeeker Just another developer trying to do the right thing September 2009 Entries
Get Both Text and Value in a DropDownList Bound to an ArrayList
If you just need a quick and dirty DropDownList of, let's say, Month values, you can simply build an ArrayList to populate it with, then bind the DropDownList to the ArrayList. This is simple and examples are easy to find on the 'net, but here's the trick: when creating ListItems for your ArrayList, give the ListItems both a Text and Value. Then set the DataTextField of the DropDownList to "Text", and the DataValueField to "Value". Then both the Text and Value properties from the ArrayList are populated ......

Posted On Thursday, September 10, 2009 11:38 PM

Copyright © Mike Ellis | Powered by: