views:

39

answers:

1

I'm trying to design a Web Part that has a drop-down list for the user to choose from. Eventually, these values will be automatically generated based on some kind of outside data source, so they're going to have somewhat arbitrary numeric values associated with them. This is the code I have now:

public enum filterChoice
    {
        All=0,
        BOCC=12,
        Sustainability=15,
        Clerk=4,
        DA=13,
        Emergency=7,
        Highlights=3,
        POS=6,
        PR=1,
        PH=5,
        SHPR=2,
        Test=8,
        Transportation=14,
        Volunteer=16
    };

These are different categories I want the user to choose from. When I choose one and save the settings for my Web Part, Sharepoint is only saving the values in numeric order; that is, All=0, BOCC=1, Sustainability=3 [...] so my Web Part then thinks the user chose the value with the corresponding number (PR when they chose BOCC, Highlights when they chose Sustainability, etc.) How can I make Sharepoint honor my custom values?

A: 

Guess you could put only strings in your enumeration and do the translation to the associated numeric values in the code of your webpart using a Dictionary<> or something?

Loek