see this link
http://www.ddj.com/windows/187202007
CodeFile is for stock projects and CodeBehind for WAP and it affects how
ASP.NET compiles the page as you probably know.
The issue with CodeFile is that the code is compiled into it's own (or
directory level assembly) and so the type may not be available to another
page unless the control is @Registered. If you dynamically load you pretty
much can't reference the ASCX codebehind class.
With WAP everything goes into a single assembly so you can reference the
codebehind class from just about anywhere...
The thing is that if you forget to set the proper format for WAP code the
page/control will still work because ASP.NET internally doesn't care whether
a project is stock or WAP so the page/control runs just fine with CodeFile.
CodeFile is used for the Web Site project type that shipped with VS.Net
2005. The Web Application Project changed this back to the original
CodeBehind used in VS 2002 and 2003 Web Application Projects.
the migration tool for going from Web Site to WAP doesn't make this change
for you, unfortunately. Hence these lingering issues.
"epower" <> wrote in message
news:607C86C4-DDD3-45B8-84A2-...
> Thanks for all your help but I finally stumbled on a solution - I have no
> idea why it works though!
>
> In the page directive for the pages that are being loaded into the iframe,
> I
> replaced
>
> Codebehind="test_page.aspx.vb"
>
> with
>
> CodeFile="test_page.aspx.vb" Inherits="test_page"
>
> Hope this helps someone else!
>
> "epower" wrote:
>
>> Hello,
>>
>> I am working on an ASP .NET application in Visual Studio 2005 and running
>> IE7.
>>
>> This application has a page that contains an iframe which loads an .aspx
>> page and hyperlinks that load the iframe with different .aspx pages. The
>> HTML/mark up for the .aspx pages executes every time, but the Page_Load
>> events for the pages never run (on initial load or subsequent loads).
>>
>> All of my research so far indicates that the page_load event should occur
>> and I have seen a version of this application (developed in framework
>> 1.1)
>> work on another server which was running IE6. Is there a difference here
>> with
>> previous versions of ASP .NET or IE that anyone knows about?
>>
>> I have developed a very simple set of test pages that recreate the
>> problem,
>> and am including the code below.
>>
>> Thank you in advance for any help!
>>
>> -----------------------------------
>> Page with IFRAME:
>>
>> <%@ Page Language="vb" Codebehind="test_iframe_page.aspx.vb" %>
>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
>> <HTML>
>> <HEAD>
>> <title>test_iframe_page</title>
>> </HEAD>
>> <body >
>> <form id="test_iframe_page" name="test_iframe_page" method="post"
>> runat="server">
>> <p>This is the test_iframe_page</p>
>> <A href="test_page2.aspx" target="iframe"><b>REFRESH IFRAME
>> WITH
>> TEST PAGE 2</b></A>
>> <br /><br />
>> <A href="test_page.aspx" target="iframe"><b>REFRESH IFRAME
>> WITH
>> TEST PAGE 1</b></A>
>> <br /><br />
>> <TABLE cellSpacing="0" cellPadding="0" width="100%" align="center"
>> border="0" height="100%">
>> <tr>
>> <td align="center" width="100%">
>> <iframe id="iframe1" name="iframe" marginWidth="0" marginHeight="0"
>> src="test_page.aspx"
>> frameBorder="yes" width="100%" scrolling="auto" height="100%">
>> </iframe>
>> </td>
>> </tr>
>> </TABLE>
>> </form>
>> </body>
>>
>> </HTML>
>>
>> Load pages:
>>
>> <%@ Page Language="vb" Codebehind="test_page.aspx.vb" %>
>> <HTML>
>> <HEAD>
>> <title>test_page</title>
>> </HEAD>
>> <body>
>> <form id="Form1">
>> <p>Hello world this is test_page!</p>
>> </form>
>> </body>
>> </HTML>
>>
>> <%@ Page Language="vb" Codebehind="test_page.aspx.vb" %>
>> <HTML>
>> <HEAD>
>> <title>test_page2</title>
>> </HEAD>
>> <body>
>> <form id="Form1">
>> <p>Hello world this is test_page2!</p>
>> </form>
>> </body>
>> </HTML>
>>
>>
>>