share enum between pages?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • oaksong

    share enum between pages?

    I've got an enum in a code behind page. It's set as public enum. How
    do I access it from another page?

    tia
    Chris
  • Nathan Sokalski

    #2
    Re: share enum between pages?

    The same way as you would anything else that you want to access from other
    pages. Just make sure it is not declared as part of the class for the page,
    it can be easy to accidentally make an enum part of the page when you don't
    want to. Or if you would like you can simply stick it in a separate file,
    this might help you keep it organized as not being part of the codebehind.
    --
    Nathan Sokalski
    njsokalski@hotm ail.com
    有声小说网为广大读者提供热门小说在线免费阅读,本站收集的网络文学小说情节跌宕起伏,有声小说网是值得书友们收藏的小说在线阅读网。


    "oaksong" <oaksong@hotmai l.comwrote in message
    news:3284801a-b385-41d8-9f35-0b0530040def@d4 5g2000hsc.googl egroups.com...
    I've got an enum in a code behind page. It's set as public enum. How
    do I access it from another page?
    >
    tia
    Chris

    Comment

    • bruce barker

      #3
      Re: share enum between pages?

      this is a bad practice. pages should not access each other. the proper
      way is to move the enum to a class file in the app code folder.

      -- bruce (sqlwork.com)


      oaksong wrote:
      I've got an enum in a code behind page. It's set as public enum. How
      do I access it from another page?
      >
      tia
      Chris

      Comment

      • oaksong

        #4
        Re: share enum between pages?

        On Sep 17, 8:45 pm, bruce barker <nos...@nospam. comwrote:
        this is a bad practice. pages should not access each other. the proper
        way is to move the enum to a class file in the app code folder.
        >
        -- bruce (sqlwork.com)
        >
        oaksong wrote:
        I've got an enum in a code behind page. It's set as public enum. How
        do I access it from another page?
        >
        tia
        Chris
        I have a class file in the app code folder. I put the enum into that
        file. When I tried to reference it from a codebehind page it produced
        an error.

        Comment

        • Norm

          #5
          Re: share enum between pages?

          On Sep 18, 11:36 am, oaksong <oaks...@hotmai l.comwrote:
          On Sep 17, 8:45 pm, bruce barker <nos...@nospam. comwrote:
          >
          this is a bad practice. pages should not access each other. the proper
          way is to move the enum to a class file in the app code folder.
          >
          -- bruce (sqlwork.com)
          >
          oaksong wrote:
          I've got an enum in a code behind page. It's set as public enum. How
          do I access it from another page?
          >
          tia
          Chris
          >
          I have a class file in the app code folder. I put the enum into that
          file. When I tried to reference it from a codebehind page it produced
          an error.
          What was the error? (nobody can help you if you just say "an error")

          Comment

          • oaksong

            #6
            Re: share enum between pages?

            On Sep 18, 1:52 pm, Norm <neon...@gmail. comwrote:
            On Sep 18, 11:36 am, oaksong <oaks...@hotmai l.comwrote:
            >
            >
            >
            >
            >
            On Sep 17, 8:45 pm, bruce barker <nos...@nospam. comwrote:
            >
            this is a bad practice. pages should not access each other. the proper
            way is to move the enum to a class file in the app code folder.
            >
            -- bruce (sqlwork.com)
            >
            oaksong wrote:
            I've got an enum in a code behind page. It's set as public enum. How
            do I access it from another page?
            >
            tia
            Chris
            >
            I have a class file in the app code folder. I put the enum into that
            file. When I tried to reference it from a codebehind page it produced
            an error.
            >
            What was the error? (nobody can help you if you just say "an error")- Hide quoted text -
            >
            - Show quoted text -
            The enum is named 'cpage'.
            The error is: error BC30451: Name 'cPage' is not declared.

            Comment

            • Norm

              #7
              Re: share enum between pages?

              On Sep 18, 11:55 am, oaksong <oaks...@hotmai l.comwrote:
              On Sep 18, 1:52 pm, Norm <neon...@gmail. comwrote:
              >
              >
              >
              On Sep 18, 11:36 am, oaksong <oaks...@hotmai l.comwrote:
              >
              On Sep 17, 8:45 pm, bruce barker <nos...@nospam. comwrote:
              >
              this is a bad practice. pages should not access each other. the proper
              way is to move the enum to a class file in the app code folder.
              >
              -- bruce (sqlwork.com)
              >
              oaksong wrote:
              I've got an enum in a code behind page. It's set as public enum. How
              do I access it from another page?
              >
              tia
              Chris
              >
              I have a class file in the app code folder. I put the enum into that
              file. When I tried to reference it from a codebehind page it produced
              an error.
              >
              What was the error? (nobody can help you if you just say "an error")- Hide quoted text -
              >
              - Show quoted text -
              >
              The enum is named 'cpage'.
              The error is: error BC30451: Name 'cPage' is not declared.
              The error means (I'm pretty sure) that the enum is not in scope.
              Without code, It's hard to diagnose. Here are some tips:

              1. Is the enum inside of a class and/or namespace?
              1.1 If in a class, is it declared "Public"?
              1.2 If in a namespace, is the namespace imported in the page that you
              are attempting to access it?

              Note: If you do end up finding the problem, make sure you post it so
              other people know the fix.

              Comment

              • Hans Kesting

                #8
                Re: share enum between pages?

                oaksong wrote :
                The enum is named 'cpage'.
                The error is: error BC30451: Name 'cPage' is not declared.
                Are you using C#? That is case-sensitive, so "cpage" and "cPage" are
                different things.

                Hans Kesting


                Comment

                • oaksong

                  #9
                  Re: share enum between pages?

                  On Sep 18, 2:08 pm, Norm <neon...@gmail. comwrote:
                  On Sep 18, 11:55 am, oaksong <oaks...@hotmai l.comwrote:
                  >
                  >
                  >
                  On Sep 18, 1:52 pm, Norm <neon...@gmail. comwrote:
                  >
                  On Sep 18, 11:36 am, oaksong <oaks...@hotmai l.comwrote:
                  >
                  On Sep 17, 8:45 pm, bruce barker <nos...@nospam. comwrote:
                  >
                  this is a bad practice. pages should not access each other. the proper
                  way is to move the enum to a class file in the app code folder.
                  >
                  -- bruce (sqlwork.com)
                  >
                  oaksong wrote:
                  I've got an enum in a code behind page. It's set as public enum.. How
                  do I access it from another page?
                  >
                  tia
                  Chris
                  >
                  I have a class file in the app code folder. I put the enum into that
                  file. When I tried to reference it from a codebehind page it produced
                  an error.
                  >
                  What was the error? (nobody can help you if you just say "an error")-Hide quoted text -
                  >
                  - Show quoted text -
                  >
                  The enum is named 'cpage'.
                  The error is: error BC30451: Name 'cPage' is not declared.
                  >
                  The error means (I'm pretty sure) that the enum is not in scope.
                  Without code, It's hard to diagnose. Here are some tips:
                  >
                  1. Is the enum inside of a class and/or namespace?
                  1.1 If in a class, is it declared "Public"?
                  1.2 If in a namespace, is the namespace imported in the page that you
                  are attempting to access it?
                  >
                  Note: If you do end up finding the problem, make sure you post it so
                  other people know the fix.
                  The reference was out of scope. I needed to import my enums class.
                  Thanks!

                  Comment

                  Working...