I have a user control which inherits from a class named BaseChart which is located in the App_Code directory. Source code is:
BaseChart.cs
public abstract class BaseChart : System.Web.UI.UserControl
{
WebChartViewer ChartViewer;
protected void Page_Load(object sender, EventArgs e)
{
...
}
}
GenericChart.ascx
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="GenericChart.ascx.cs" Inherits="UserControls_GenericChart" CodeFileBaseClass="BaseChart" %>
GenericChart.asc.cs
public partial class UserControls_GenericChart : BaseChart
{
}
Now that above code compiles perfectly ok. The problems begin when I add an instance of the WebChartViewer control into the GenericChart.ascx. The WebchartViewer is a 3rd party component.
Updated GenericChart.ascx
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="GenericChart.ascx.cs" Inherits="UserControls_GenericChart" CodeFileBaseClass="BaseChart" %>
<%@ Register Assembly="netchartdir" Namespace="ChartDirector" TagPrefix="chart" %>
<chart:WebChartViewer ID="ChartViewer" runat="server" />
The addition of these two extra lines of code will cause the compile error:
Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl).
I have added ASP.NET server controls to the GenericChart.ascx file without causing this compile error which appears to be generated from this particular control which is located in a separate assembly.
I have scoured the forums for a solution to this and have already tried and failed with the following recommended solutions:
- stop IIS, delete Temp ASP.NET files and try again
- Added the control tag prefix to the <controls> in the web.config file
Can anyone help?
gec.
BaseChart.cs
public abstract class BaseChart : System.Web.UI.UserControl
{
WebChartViewer ChartViewer;
protected void Page_Load(object sender, EventArgs e)
{
...
}
}
GenericChart.ascx
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="GenericChart.ascx.cs" Inherits="UserControls_GenericChart" CodeFileBaseClass="BaseChart" %>
GenericChart.asc.cs
public partial class UserControls_GenericChart : BaseChart
{
}
Now that above code compiles perfectly ok. The problems begin when I add an instance of the WebChartViewer control into the GenericChart.ascx. The WebchartViewer is a 3rd party component.
Updated GenericChart.ascx
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="GenericChart.ascx.cs" Inherits="UserControls_GenericChart" CodeFileBaseClass="BaseChart" %>
<%@ Register Assembly="netchartdir" Namespace="ChartDirector" TagPrefix="chart" %>
<chart:WebChartViewer ID="ChartViewer" runat="server" />
The addition of these two extra lines of code will cause the compile error:
Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl).
I have added ASP.NET server controls to the GenericChart.ascx file without causing this compile error which appears to be generated from this particular control which is located in a separate assembly.
I have scoured the forums for a solution to this and have already tried and failed with the following recommended solutions:
- stop IIS, delete Temp ASP.NET files and try again
- Added the control tag prefix to the <controls> in the web.config file
Can anyone help?
gec.