DropDownList Issue

Discussion in 'ASP .Net' started by shapper, Jan 12, 2007.

  1. shapper

    shapper Guest

    Hello,

    I have an Enumeration as follows:

    Public Enum City
    NewYork
    London
    End Enum

    I have a function which returns a string for each City for different
    culture:

    Public Function City2String(ByVal myCity As City, ByVal culture As
    CultureInfo) As String
    Select Case culture.Name
    Case "pt-PT"
    Select Case city
    Case Enumeration.City.NewYork
    Return "Nova Iorque"
    Case Enumeration.City.London
    Return "Londres"
    ...
    End Select
    End Function

    I have a Profile variable named MyCity of type City.

    I need to populate the DropDownList with all EnumValues using
    City2String to show the text in the correct culture (THIS IS DONE).

    Then I need to make something as Profile.MyCity = Selelected Value in
    ddlCity.

    What should be the best way to do this?

    Remember that a DropDownList only has strings. The only think I can
    think off is to create a function String2City for all cultures.

    However this seems a waste of code.

    Any idea?

    Thanks,

    Miguel
    shapper, Jan 12, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. mr2_93
    Replies:
    1
    Views:
    3,581
    mr2_93
    Oct 2, 2005
  2. tshad
    Replies:
    8
    Views:
    2,204
    tshad
    Oct 19, 2005
  3. =?Utf-8?B?SnVhbmpv?=

    GridView: Filtr DropDownList from another DropDownList

    =?Utf-8?B?SnVhbmpv?=, Dec 23, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    1,846
    =?Utf-8?B?SnVhbmpv?=
    Dec 23, 2005
  4. =?Utf-8?B?SnVhbmpv?=

    GridView: Filter DropDownList for another DropDownList

    =?Utf-8?B?SnVhbmpv?=, Dec 29, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    1,281
    =?Utf-8?B?SnVhbmpv?=
    Dec 29, 2005
  5. keithb
    Replies:
    1
    Views:
    11,910
    shauns1
    Nov 1, 2006
Loading...

Share This Page