Saturday, April 2, 2011

Display more than 1 display values in a dropdown with ',' seperated

Are you looking for displaying more than 12 values in a dropdown with ',' seperated.
It is possible using the generics DICTIONARY class:
CODE::

---------------------------------------------------------------------------------
Dictionary dctLists = null;
//Setting the dictionary item list
dctLists = new Dictionary();
dctLists.Add("hyderabad", 500020);
dctLists.Add("sec-bad", 500009);
dctLists.Add("chikkadpally", 500020);

//Display more than 1 value in the dropdown
ddlMultipleValsDisplaye.DataSource = dctLists;
ddlMultipleValsDisplaye.DataBind();

---------------------------------------------------------------------------------

if you run the above code, then you will see that both the valuees from the dictionary are displayed in the dropdownlist.

No comments:

Post a Comment