[thelist] [C#] Inheriting code-behind classes
Howard Cheng
howcheng at ix.netcom.com
Tue Apr 9 17:22:01 CDT 2002
At 02:38 PM 4/9/2002 -0700, Matt Liotta wrote:
>Alright, I see my confusion. You are trying to extend Page, not Page1.
>Whoops. Anyway, what you need to do is make Common abstract.
>
>-Matt
OK, tried that, but still no results. Perhaps some code will help.
ASPX page (simplified):
<%@ Page Inherits="xxx.FirstClass" ClassName="FirstClass" %>
[html]
[body]
[div id="mydiv" runat="server"/]
[/body]
[/html]
Code-behind page (simplified):
public class FirstClass : xxx.CommonClass
{
public HtmlGenericControl mydiv = new HtmlGenericControl();
protected override void Page_Load(Object Source, EventArgs E)
{
mydiv.InnerHtml = "Hello World!";
}
}
Inherited class:
public abstract class CommonClass : System.Web.UI.Page
{
protected void Page_Init(Object Source, EventArgs E)
{
// does stuff
}
protected abstract void Page_Load(Object Source, EventArgs E);
protected void Page_Unload(Object Source, EventArgs E)
{
// does stuff
}
}
This doesn't work. The page should display "Hello World" but I get nothing.
Any clues?
::::::::::::::::::::::
Howard Cheng
howcheng at ix.netcom.com
AIM: bennyphoebe
ICQ: 47319315
More information about the thelist
mailing list