Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Passing Enum To Method
Message
From
17/03/2010 12:22:28
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
 
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01455109
Message ID:
01455114
Views:
35
>I created a Web Control. In it is this enum:
>
>
>public enum PageMode
>{
>    New,
>    Edit,
>    View
>}
>
>
>From outside the control I'm trying to do:
>
>
>crlRoles.SetPageMode(crlRoles.PageMode.Edit);
>
>
>I'm getting a compile error "'PageMode': cannot reference a type through an expression; try 'crlRoles.PageMode' instead".
>
>How do I do this in an ASP.Net app?

I generally find it better not to place enums inside of classes unless you only plan on using it within the class. That doesn't seem to be the case here, so why not put the enum in its own file and move it outside the class. In web apps I have a folder called Enums and I put them all in there where they are used in the web pages.
Tim
Timothy Bryan
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform