On Sep 8, 12:34*pm, "Mark Rae [MVP]" <m...@markNOSPAMrae.net> wrote:
> "shapper" <mdmo...@gmail.com> wrote in message
>
> news:f2d3782c-4e29-45a8-9d9e-(E-Mail Removed)...
>
> >>> Item 1 > Name = "New York", Value = "NY".
>
> >> Hmm - are you sure you're not talking about a Dictionary<>...?
>
> >> Dictionary<string, string> MyDictionary = new Dictionary<string,
> >> string>();
> >> MyDictionary.Add("New York", "NY");
>
> > I am using this in an DropDownList. Shouldn't be a SelectList?
>
> Perhaps we're getting bogged down by nomenclature here... Can you please
> clarify precisely which object you are referring to as a "SelectList"...?
>
> Some of your code would be helpful...
>
> --
> Mark Rae
> ASP.NET MVPhttp://www.markrae.net
Sure.
I am creating in an ASP.NET MVC view a DropDownList:
<%= Html.DropDownList( "", "Cities", new SelectList( new [] { "New
York", "Paris", "London" } ) ) %>
However, I would like each item to have a name different from its
value. For example:
"New York" would display as "New York" but the value would be "NY".
Thanks,
Miguel
|