I want to create a user control DerivedUserControl.ascxthat displays the form of another user control BaseUserControl.ascx. Management of the basic user comes from System.Web.UI.UserControlas needed. These user controls are defined in different folders. Since I am using a Visual Studio 2010 Web Site project (I cannot switch to a web application project), these user controls are not defined inside the namespace.
My problem is that when I try to compile the project, the base class of the derived user control cannot be resolved (obviously, because the compiler does not know which .ascx file defines the base class). Is there any way to solve this problem?
I tried everything I could imagine without success. Any help would be greatly appreciated.
BaseUserControl.ascx
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="BaseUserControl.ascx.cs" Inherits="BaseUserControl" %>
BaseUserControl.ascx.cs
public partial class BaseUserControl : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
DerivedUserControl.ascx
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="DerivedUserControl.ascx.cs" Inherits="DerivedUserControl" %>
DerivedUserControl.ascx.cs
public partial class DerivedUserControl : BaseUserControl
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
Error
The type or namespace name 'BaseUserControl' could not be found
source
share