Wrong Code-Behind Page being referenced

  • Thread starter Thread starter Jeff Cooper
  • Start date Start date
J

Jeff Cooper

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="header1.aspx.vb" and header2.aspx has
CodeBehind="header2.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
 
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.


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="header1.aspx.vb" and header2.aspx has
CodeBehind="header2.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
 
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.
 
Back
Top