Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Binding to Enum
Message
De
27/07/2007 12:48:23
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Titre:
Binding to Enum
Divers
Thread ID:
01244160
Message ID:
01244160
Vues:
70
Hi,

I'm trying to work out the best way to allow a user to select an Enum value in a Combobox. I've modified a BO Entity (based on code from the BLG) as follows:
        public Array SecurityAccessLevelOptions
        {
            get{return Enum.GetNames(typeof(OakLeaf.MM.Main.Security.mmSecurityAccessLevel));}
        }

        public string DefaultSecurityAccessLevelString
        {
            get {
                return Enum.GetName(typeof(OakLeaf.MM.Main.Security.mmSecurityAccessLevel),DefaultSecurityAccessLevel); 
                }
            set {
                DefaultSecurityAccessLevel = 
                    (OakLeaf.MM.Main.Security.mmSecurityAccessLevel)Enum.Parse(typeof(OakLeaf.MM.Main.Security.mmSecurityAccessLevel), value);
                }
        }       
        
        /// <summary>
		/// DefaultSecurityAccessLevel
		/// </summary>
		public OakLeaf.MM.Main.Security.mmSecurityAccessLevel DefaultSecurityAccessLevel
		{
			get
			{
				if (this.Row != null)
                    return (OakLeaf.MM.Main.Security.mmSecurityAccessLevel)mmType.GetNonNullableDbValue(this.Row["DefaultSecurityAccessLevel"], "System.Int32");
				else
					return this._defaultsecurityaccesslevel;
			}
			set
			{
				if (this.Row != null)
					this.Row["DefaultSecurityAccessLevel"] = value; 
				this._defaultsecurityaccesslevel = value;
			}
		}
        private OakLeaf.MM.Main.Security.mmSecurityAccessLevel _defaultsecurityaccesslevel;
I can use SecurityAccessLevelOptions as the datasource for the combobox but for some reason cannot work out how to bind the combobox to DefaultSecurityAccessLevelString. Should that be possible (and if so how)?
TIA,
Viv
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform