Wrong Code-Behind Page being referenced

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

    #1

    Wrong Code-Behind Page being referenced

    Hey Folks,

    I have a bunch of aspx pages in a solution. One of these pages, call it
    header1.aspx, has it's code behind in header1.aspx.vb . Another,
    header2.aspx, has header2.aspx.vb . When I double-click a web control on
    header1.aspx, it brings me to the code behind for header2! In fact, the
    code behind page header1.aspx.vb doesn't even recognize the controls on page
    header1.aspx.

    BUT, header2.aspx.vb recognizes the controls from header1.aspx.

    The @ Page tag at the top of each page has the correct vb file listed
    (header1.aspx has CodeBehind="hea der1.aspx.vb" and header2.aspx has
    CodeBehind="hea der2.aspx.vb").

    Earlier, I notice something got messed up and the header1.aspx Page tag had
    it's code behind pointing to header2.aspx.vb , but I changed that and now the
    proper vb files (with their proper resx files) are under ther respective
    aspx pages in the Solution Explorer.

    Anyone know if there is some other tag/setting/whatever to get an aspx page
    pointing to the right vb file?

    Thanks,

    Jeff


  • Ken Cox [MVP]

    #2
    Re: Wrong Code-Behind Page being referenced

    Hi Jeff,

    Is it possible that the src attribute in the .aspx file is pointing to the
    right place but the inherits is looking at the wrong class? I've made that
    mistake when doing a copy/paste file within VS.NET.


    "Jeff Cooper" <jscooper@compu dude.com> wrote in message
    news:UW0jb.5594 3$mQ2.21149@new sread1.news.atl .earthlink.net. ..
    Hey Folks,

    I have a bunch of aspx pages in a solution. One of these pages, call it
    header1.aspx, has it's code behind in header1.aspx.vb . Another,
    header2.aspx, has header2.aspx.vb . When I double-click a web control on
    header1.aspx, it brings me to the code behind for header2! In fact, the
    code behind page header1.aspx.vb doesn't even recognize the controls on page
    header1.aspx.

    BUT, header2.aspx.vb recognizes the controls from header1.aspx.

    The @ Page tag at the top of each page has the correct vb file listed
    (header1.aspx has CodeBehind="hea der1.aspx.vb" and header2.aspx has
    CodeBehind="hea der2.aspx.vb").

    Earlier, I notice something got messed up and the header1.aspx Page tag had
    it's code behind pointing to header2.aspx.vb , but I changed that and now the
    proper vb files (with their proper resx files) are under ther respective
    aspx pages in the Solution Explorer.

    Anyone know if there is some other tag/setting/whatever to get an aspx page
    pointing to the right vb file?

    Thanks,

    Jeff



    Comment

    • Ken Cox  [Microsoft MVP]

      #3
      Re: Wrong Code-Behind Page being referenced



      Comment

      • Bret Mulvey [MS]

        #4
        Re: Wrong Code-Behind Page being referenced

        The Codebehind attribute doesn't do anything at runtime. This just tells
        VS.NET what source files to compile into code-behind classes in the .dll for
        your bin folder. What matters is the Inherits attribute which tells ASP.NET
        which class to use from that dll. You might have the same Inherits attribute
        on both pages, causing both pages to inherit from the same page class.

        "Jeff Cooper" <jscooper@compu dude.com> wrote in message
        news:UW0jb.5594 3$mQ2.21149@new sread1.news.atl .earthlink.net. ..[color=blue]
        > Hey Folks,
        >
        > I have a bunch of aspx pages in a solution. One of these pages, call it
        > header1.aspx, has it's code behind in header1.aspx.vb . Another,
        > header2.aspx, has header2.aspx.vb . When I double-click a web control on
        > header1.aspx, it brings me to the code behind for header2! In fact, the
        > code behind page header1.aspx.vb doesn't even recognize the controls on[/color]
        page[color=blue]
        > header1.aspx.
        >
        > BUT, header2.aspx.vb recognizes the controls from header1.aspx.
        >
        > The @ Page tag at the top of each page has the correct vb file listed
        > (header1.aspx has CodeBehind="hea der1.aspx.vb" and header2.aspx has
        > CodeBehind="hea der2.aspx.vb").
        >
        > Earlier, I notice something got messed up and the header1.aspx Page tag[/color]
        had[color=blue]
        > it's code behind pointing to header2.aspx.vb , but I changed that and now[/color]
        the[color=blue]
        > proper vb files (with their proper resx files) are under ther respective
        > aspx pages in the Solution Explorer.
        >
        > Anyone know if there is some other tag/setting/whatever to get an aspx[/color]
        page[color=blue]
        > pointing to the right vb file?
        >
        > Thanks,
        >
        > Jeff
        >
        >[/color]


        Comment

        • Jeff Cooper

          #5
          Re: Wrong Code-Behind Page being referenced

          That was it. The inherits was pointing to the wrong class. Thanks!

          "Jeff Cooper" <jscooper@compu dude.com> wrote in message
          news:UW0jb.5594 3$mQ2.21149@new sread1.news.atl .earthlink.net. ..[color=blue]
          > Hey Folks,
          >
          > I have a bunch of aspx pages in a solution. One of these pages, call it
          > header1.aspx, has it's code behind in header1.aspx.vb . Another,
          > header2.aspx, has header2.aspx.vb . When I double-click a web control on
          > header1.aspx, it brings me to the code behind for header2! In fact, the
          > code behind page header1.aspx.vb doesn't even recognize the controls on[/color]
          page[color=blue]
          > header1.aspx.
          >
          > BUT, header2.aspx.vb recognizes the controls from header1.aspx.
          >
          > The @ Page tag at the top of each page has the correct vb file listed
          > (header1.aspx has CodeBehind="hea der1.aspx.vb" and header2.aspx has
          > CodeBehind="hea der2.aspx.vb").
          >
          > Earlier, I notice something got messed up and the header1.aspx Page tag[/color]
          had[color=blue]
          > it's code behind pointing to header2.aspx.vb , but I changed that and now[/color]
          the[color=blue]
          > proper vb files (with their proper resx files) are under ther respective
          > aspx pages in the Solution Explorer.
          >
          > Anyone know if there is some other tag/setting/whatever to get an aspx[/color]
          page[color=blue]
          > pointing to the right vb file?
          >
          > Thanks,
          >
          > Jeff
          >
          >[/color]


          Comment

          Working...