[thelist] [C#] Inheriting code-behind classes
Howard Cheng
howcheng at ix.netcom.com
Tue Apr 9 15:53:01 CDT 2002
I tried the ASPFriends C# list but am not getting any responses, so I'm
cross-posting here.
I'm working on my first C#/.NET project and I have a problem that I'm
hoping someone can help me with.
I have two ASPX pages which have similar functionality, so my plan of
attack is to have the code-behind classes for those two pages inherit from
a common class, which in turn inherits from Page.
First, is this possible?
Assuming it is, here's what I've laid out so far (code omitted):
page1.cs
--------
namespace xxx
{
public class Page1 : xxx.Common
{
private void Page_Load(Object Source, EventArgs E)
{
}
}
}
common.cs
---------
namespace xxx
{
public class Common : Page
{
protected void Page_Init(Object Source, EventArgs E)
{
}
protected void Page_Unload(Object Source, EventArgs E)
{
}
}
}
Using VS.NET, I've compiled them into a .dll which is in the /bin directory
(no errors during compilation).
However, this doesn't seem to do anything. The code in Page_Load() doesn't
seem to do anything. I have a [div runat="server"/] in the ASPX page and
change its content in Page_Load(), but nothing happens.
On the ASPX page, the first line is:
<%@ Page language="C#" Inherits="xxx.Page1" %>
<%@ Assembly name="xxx" %>
Thanks in advance for any help.
::::::::::::::::::::::
Howard Cheng
howcheng at ix.netcom.com
AIM: bennyphoebe
ICQ: 47319315
More information about the thelist
mailing list