K
Ken Fine
Hi, I have what I think is a simple type conversion problem.
I am building user controls. In the VS.NET IDE I want to be able to use
enumerations when assigning properties. I do this by building an
enumeration:
public enum PageProtectionMode { NoProtection, LimitToAccountHolders,
LimitToSpecialAccountHolders, LimitByRoles,
LimitToCommaDelimitedListOfUsernames }
.... and by building a property that uses that enumeration:
private PageProtectionMode pageprotectionmodechoice;
public PageProtectionMode PageProtectionModeChoice
{
get { return pageprotectionmodechoice); }
set { pageprotectionmodechoice = value; }
}
The above code functions in the IDE, and I get intellisense when editing the
non-codebehind ASCX but when I try to run it, I get:
Cannot create an object of type
'_usercontrols_general_AdminGeneralOverview+PageProtectionMode' from its
string representation 'LimitToSpecialAccountHolders'
Somewhere in this I'm guessing I either need an "Parse.Enum" or something
like it, or maybe I'm bumping into a hard limit of the behavior of user
controls. Can anyone suggest some code or syntax to help?
-KF
I am building user controls. In the VS.NET IDE I want to be able to use
enumerations when assigning properties. I do this by building an
enumeration:
public enum PageProtectionMode { NoProtection, LimitToAccountHolders,
LimitToSpecialAccountHolders, LimitByRoles,
LimitToCommaDelimitedListOfUsernames }
.... and by building a property that uses that enumeration:
private PageProtectionMode pageprotectionmodechoice;
public PageProtectionMode PageProtectionModeChoice
{
get { return pageprotectionmodechoice); }
set { pageprotectionmodechoice = value; }
}
The above code functions in the IDE, and I get intellisense when editing the
non-codebehind ASCX but when I try to run it, I get:
Cannot create an object of type
'_usercontrols_general_AdminGeneralOverview+PageProtectionMode' from its
string representation 'LimitToSpecialAccountHolders'
Somewhere in this I'm guessing I either need an "Parse.Enum" or something
like it, or maybe I'm bumping into a hard limit of the behavior of user
controls. Can anyone suggest some code or syntax to help?
-KF