J
Jiri Zidek
The problem is that I cannot use VS graphical designer to design my ASCX
controls that do not inherit directly from System.Web.UI.UserControl but
they inherit from my base class (which is in fact derived from
System.Web.UI.UserControl).
The VS gives me error:
"The file could not be loaded into the Web FOrms designer. Please correct
the foloowing error and then try loading it again:
The designer could not e shown for this file because none of the classes
within it can be designed. The designer inspected the following classes in
the file:
WebUserControl1 -- The ase class 'WebApplication1.BaseWebUSerControl' could
not be loaded. Ensure the assembly has been referenced or built if it is
part of the project. Make sure all of the classes used in the page are built
or referenced in the project."
Important point: compiling project is OK and when running the pages with
such controls everything wokrs fine.
What should I make to work it with designer again ? Some attributes ? Some
interfaces reimplement ?
Thanks - Jiri
Detailed description:
The idea is similar to idea of baseclass for pages described in
http://www.codeproject.com/aspnet/AspNetInheritance.asp. I need to use some
common functionality for set of web UserControls, I decided to use a common
baseclass that inherits form System.Web.UI.UserControl:
public abstract class BaseWebUserControl : System.Web.UI.UserControl {
......
}
The ASCX file of this base class is almost empty:
<%@ Control Language="c#" AutoEventWireup="false"
Codebehind="BaseWebUserControl.ascx.cs"
Inherits="WebApplication1.BaseWebUserControl"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
Then I construct my derived ASCX control with code behind:
public class WebUserControl1 : BaseWebUserControl {
......
}
The ASCX file of this derived control is simple:
<%@ Control Language="c#" AutoEventWireup="false"
Codebehind="WebUserControl1.ascx.cs"
Inherits="WebApplication1.WebUserControl1"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
<asp:textbox id="TextBox1" runat="server"></asp:textbox>
<asp:button id="Button1" runat="server" text="Button"></asp:button>
The concept works well for runtime, bud VS designer gets confused.
I use VS2003. No problem to send simple project showingthe effect.
controls that do not inherit directly from System.Web.UI.UserControl but
they inherit from my base class (which is in fact derived from
System.Web.UI.UserControl).
The VS gives me error:
"The file could not be loaded into the Web FOrms designer. Please correct
the foloowing error and then try loading it again:
The designer could not e shown for this file because none of the classes
within it can be designed. The designer inspected the following classes in
the file:
WebUserControl1 -- The ase class 'WebApplication1.BaseWebUSerControl' could
not be loaded. Ensure the assembly has been referenced or built if it is
part of the project. Make sure all of the classes used in the page are built
or referenced in the project."
Important point: compiling project is OK and when running the pages with
such controls everything wokrs fine.
What should I make to work it with designer again ? Some attributes ? Some
interfaces reimplement ?
Thanks - Jiri
Detailed description:
The idea is similar to idea of baseclass for pages described in
http://www.codeproject.com/aspnet/AspNetInheritance.asp. I need to use some
common functionality for set of web UserControls, I decided to use a common
baseclass that inherits form System.Web.UI.UserControl:
public abstract class BaseWebUserControl : System.Web.UI.UserControl {
......
}
The ASCX file of this base class is almost empty:
<%@ Control Language="c#" AutoEventWireup="false"
Codebehind="BaseWebUserControl.ascx.cs"
Inherits="WebApplication1.BaseWebUserControl"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
Then I construct my derived ASCX control with code behind:
public class WebUserControl1 : BaseWebUserControl {
......
}
The ASCX file of this derived control is simple:
<%@ Control Language="c#" AutoEventWireup="false"
Codebehind="WebUserControl1.ascx.cs"
Inherits="WebApplication1.WebUserControl1"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
<asp:textbox id="TextBox1" runat="server"></asp:textbox>
<asp:button id="Button1" runat="server" text="Button"></asp:button>
The concept works well for runtime, bud VS designer gets confused.
I use VS2003. No problem to send simple project showingthe effect.