CodeSeeker

Just another developer trying to do the right thing
posts - 20, comments - 22, trackbacks - 0

My Links

News

Archives

Blogs

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...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Posted On Thursday, September 10, 2009 11:38 PM | Feedback (3) |

Powered by: