Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > problem putting enum in page_load

Reply
Thread Tools

problem putting enum in page_load

 
 
tony collier
Guest
Posts: n/a
 
      01-21-2004
I have the following in one of my .aspx pages:

.....

<script runat="server">

enum bookstores

{
Amazon,
Blackwells,
ComputerManuals,
ComputerBooks
};

void Page_Load(Object sender, EventArgs e)

{


// DECLARE VARIABLES

.....

}

</script>


can someone tell me why the above works fine, yet if i put the enum
declaration IN Page_Load function above // DECLARE VARIABLES I get:


Compiler Error Message: CS1513: } expected

Line 10: void Page_Load(Object sender, EventArgs e)
Line 11:
Line 12: {
Line 13:
Line 14: enum bookstores


error on line 12 ?


Thanks to anyone who can throw light on this
 
Reply With Quote
 
 
 
 
Teemu Keiski
Guest
Posts: n/a
 
      01-22-2004
Enum is one value type in .NET (inherits from System.Enum). Types are
declared separately of their usage meaning you can consume / use the type
inside the method, but you declare it outside the method, just as class or
any other type would be. They are declared at namespace level and used as
class/member level.

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist


"tony collier" <(E-Mail Removed)> wrote in message
news:Xns9477C833E8015melakkahotmailcom@140.99.99.1 30...
>I have the following in one of my .aspx pages:
>
> ....
>
> <script runat="server">
>
> enum bookstores
>
> {
> Amazon,
> Blackwells,
> ComputerManuals,
> ComputerBooks
> };
>
> void Page_Load(Object sender, EventArgs e)
>
> {
>
>
> // DECLARE VARIABLES
>
> ....
>
> }
>
> </script>
>
>
> can someone tell me why the above works fine, yet if i put the enum
> declaration IN Page_Load function above // DECLARE VARIABLES I get:
>
>
> Compiler Error Message: CS1513: } expected
>
> Line 10: void Page_Load(Object sender, EventArgs e)
> Line 11:
> Line 12: {
> Line 13:
> Line 14: enum bookstores
>
>
> error on line 12 ?
>
>
> Thanks to anyone who can throw light on this



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
putting code in master page Page_Load event moves everything on the page down 2 lines? Sunfire ASP .Net 2 11-05-2007 07:58 PM
Materpage page_load event fired after content page_load? rockdale ASP .Net 1 11-16-2006 06:59 PM
in VB.NET Page_load of a base class called after the derived class Page_load ? z. f. ASP .Net 0 10-19-2004 12:01 PM
Difference between putting code in constructor and putting code in static{} Saurabh Java 6 05-30-2004 02:44 PM
Why does page_load fire twice when inheriting from a common overridable Page_Load bminder ASP .Net 1 02-23-2004 08:54 PM



Advertisments