Wrong Code-Behind Page being referenced

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
 
K

Ken Cox [MVP]

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
 
B

Bret Mulvey [MS]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top