Last post Aug 23, 2006 04:42 PM by a468950
Aug 22, 2006 05:44 AM|a468950|LINK
In ASP.NET 1.x, every page has an explicit class name so if you have an aspx name named MyPage, it can be called inside a user control it contains by doing a cast:
It's not a good way to create such a dependency but sometimes necessary. In ASP.NET 2.0, how to do this? The page class name is not allowed in the child control as doing <% Reference Page="MyPage.aspx"%> in the child control results in a circular reference
error during compile.
Aug 22, 2006 07:17 AM|joteke|LINK
see Understanding Page Inheritance in ASP.NET 2.0
Basically you'd create a base class for your page into App_Code (exposing all needed functionality via the base class) and derive your page from it. UC could then cast Page to the base type and use it.
Another way is to use Web Application Project Model (extenmsion to VS2005 by MS) which allows you to work as you worked with 1.x.
Aug 23, 2006 04:42 PM|a468950|LINK
Thanks a lot. uh, forgot about the base class inthe App_Code folder option. I'm reluctant to add an extra layer there since such a need is rarely common, that is, the page function that needs to be refrenced is different from page to page.
Still don't understand why MS favored the Web Site Project model over Web Application Project in VS 2005.