Ask a Question related to ASP.NET Building Controls, Design and Development.
-
Jiri Zidek #1
When base class is used for UserControl, VS designer fails to load ASCX file
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
[url]http://www.codeproject.com/aspnet/AspNetInheritance.asp[/url]. 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.
Jiri Zidek Guest
-
Base designer class missing in 2.0
Hi, I cannot find the base ControlDesigner class in 2.0. All of the documentation I have found points to System.Web.UI.Design.ControlDesigner... -
MustInherit base class inherited by UserControl
Following on from this discussion http://www.dotnet247.com/247reference/msgs/29/146830.aspx i'm having the same problem, the classes that i... -
Base usercontrol class and wrapping
I have created a base class that inherits UserControl. The purpose of this class is to implement common functionality for all of my usercontrols... -
how to load an ascx file in class.vb ?
I need to import an *;ascx, as an object, in my class, that is in myclass.vb. How can i do ? i saw the method LoadControl but i can't use it, or... -
Designer refuses to load webform when some of base classes was changed
We have some base classes library which includes also base web form class. In every new project we adding one web form class which inherits from our... -
Jiri Zidek #2
Re: When base class is used for UserControl, VS designer fails to load ASCX file
Thanks for response. Your clases are almost the same as in my testing
project. To be sure I have made a test with yours: a) New WebApplication, a)
copied your files to the aspx/cs directory, c) Include in project. d) Double
click on DerivedUserControl.ascx in Solution explorer yields the same error
as described below.
See Err-1.png on path [url]http://firma.atlantis.cz/msft[/url] . When pressing OK, the
ASCX file is displayed but only in HTML view, no Design view available - see
Err-2.png.
But again: Bulding - OK, running testpage,.aspx - OK. see OK-3.png in the
URL above.
Try with your project to do the same (double click DerivedUserControl.ascx,
which normally opens design view of ascx) - if working for you - then the
defect is in my VS2003 installation so I will consider reinstallation (and
please rceive appologise my bothering).
If anything more needed no problem.
Regards
Jiri
"Steven Cheng[MSFT]" <v-schang@online.microsoft.com> píše v diskusním
příspěvku news:4pwwMiB2EHA.3388@cpmsftngxa10.phx.gbl...> Hi Jiri,
>
> Thanks for your posting. From your description, you have some
> WebUserControls which dervied from a custom Base UserControl Class(
> derived
> from the System.Web.UI.UserControl). They works well at runtime, but can't
> be loaded correctly in the VS.NET's Design-View at design-time, yes? If
> anything I misunderstood or not complete, please feel free to let me know.
>
> I'm not sure on the detailed control content and code behind code logic of
> your usercontrols, based on my local test, the derivded control is ok to
> be
> loaded into Design-View. And I suspect whether there is anything incorrect
> when the DESIGN-VIEW load the base control class and try to mapping some
> class members or other things. Also, are the BaseControl and Derived
> Control classses put in the same location in the project?
>
> Anyway, I've attached my test controls and page in this message , you can
> have a test on your side to see whether t here is anything different. Hope
> this helps. If there is any new findings, please feel free to post here.
>
> Thanks.
>
> Regards,
>
> Steven Cheng
> Microsoft Online Support
>
> Get Secure! [url]www.microsoft.com/security[/url]
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
Jiri Zidek Guest
-
Steven Cheng[MSFT] #3
Re: When base class is used for UserControl, VS designer fails to load ASCX file
Hi Jiri,
Thanks for your response. Yes, I just test follow the exact same steps you
mentioned, double click the
"ascx " file to display the Usercontrol in VS.NET's design view and that
works ok. Also, I just test again on a XP SP2 box (my original test on a
win2k3 box), both with .net framework1.1 vs.net2003 installed. Not sure
any
enviromential specific problems on your box. But I think before you
considering reinstall, it is recommend that you try testing on some other
machines on your side to double check this.
If there is anything else we can help, please feel free to post here.
Thanks.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! [url]www.microsoft.com/security[/url]
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Steven Cheng[MSFT] Guest
-
Jiri Zidek #4
Re: When base class is used for UserControl, VS designer fails to load ASCX file
Hello,
Good idea. I have tested this "inheritance" on another machine and designer
works without the problem. So I conclude - the defect is in my own VS
installation. Sorry for bothering.
Jiri
Jiri Zidek Guest
-
Steven Cheng[MSFT] #5
Re: When base class is used for UserControl, VS designer fails to load ASCX file
Thanks for your followup Jiri,
You're always welcome to post here.
Good luck!
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! [url]www.microsoft.com/security[/url]
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Steven Cheng[MSFT] Guest
-
Jiri Zidek #6
Re: When base class is used for UserControl, VS designer fails to load ASCX file
Hello,
If anybody has encountered this kind of problem:
Why: because I am using roaming profile (i.e. my Documents, Desktop and Data
Application folders are on netowork!), VS stores "some" information in these
locations, which do not have FullTrust by default (in spite of the fact that
all my "dev" files are locally on "C:"
What to do: set FullTrust for the "Local intranet" code group (using Wizard)
See also: [url]http://www.ai.uga.edu/mc/VisualStudioGotchas.html[/url]
Or:
[url]http://www.error-bank.com/microsoft.public.dotnet.framework.aspnet.webcontro ls/15635_Thread.aspx[/url]
Jiri
"Jiri Zidek" <Pazu@community.nospam> píše v diskusním příspěvku news:...> Hello,
>
> Good idea. I have tested this "inheritance" on another machine and
> designer works without the problem. So I conclude - the defect is in my
> own VS installation. Sorry for bothering.
>
> Jiri
>
Jiri Zidek Guest



Reply With Quote

