View Single Post
Old July 28th, 2004, 11:22 AM
Imar's Avatar
Imar Imar is offline
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts

You're mixing up two technologies.

When you are using Visual Studio.NET, all code goes in a Code Behind file (named after your ASPX page with a VB or CS extension).

When the project is compiled, VS.NET takes this code and compiles all your pages in a single assembly. At run time, this single assembly is used to "map" your ASPX page to the class it derives from, and then the code in that class is executed. So, in VS.NET, the Page_Load is compiled into a class called MyPage for example, and when you request MyPage.aspx, the method MyPage.Page_Load will fire.

In "flat" ASPX pages, you have in-line code, usually located at the top of the page. You can put code there that is run when the page is requested.

When you mix these concepts, the runtime gets confused. Should it get the methods from the in-line code? or from the compiled assembly?

When you removed Inherits, you effectively detached the page from the assembly that VS.NET has created, making it a "stand alone" page.

If you are working with VS.NET, you're better off not writing in-line code. Instead, add all the code in the Code Behind file.


Imar Spaanjaars
Everyone is unique, except for me.