Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Binding to Enum
Message
From
27/07/2007 12:48:23
 
 
To
All
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Title:
Binding to Enum
Miscellaneous
Thread ID:
01244160
Message ID:
01244160
Views:
69
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
Next
Reply
Map
View

Click here to load this message in the networking platform