all groups > asp.net building controls > october 2003 >
You're in the

asp.net building controls

group:

User Control and VS design time issues


User Control and VS design time issues Munish Sethi
10/31/2003 1:31:47 PM
asp.net building controls:
I have a User Control with a Code behind class.

If the Code behind class inherits from UserControl class there are no
problems within VS 2003, I can double click on the User Control (in VS
2003 solution explorer) and bring it up without getting any warnings in
VS Design time environment.

If, however the Code behind class inherits from another class (say
MyClass1), which in turn inherits from UserControl class, I get the
following warning in VS 2003 designer when I try to bring up the User
Control in VS design environment

---------------------------
Microsoft Development Environment
---------------------------
The file could not be loaded into the Web Forms designer. Please correct
the following error and then try loading it again:

Type Abstract

Make sure all of the classes used in the page are built or referenced in
the project. Click Help for more information.
---------------------------
OK Help

Basically I have a bunch of User Controls, all of which inherit from a
Base Class, the Base Class in turn Inherits class UserControl.
Application works no problem, however the design time experience is
lacking. I am unable to display the User Control in the "Design" tab
inside VS 2003; after the warning is displayed I can see my control in
HTML mode only.


Any pointers on how to overcome this issue?

Regards

Munish


<b> Munish </b>

*** Sent via Developersdex http://www.developersdex.com ***
Re: User Control and VS design time issues Nicole Calinoiu
10/31/2003 4:37:15 PM
Munish,

The VS.NET 2002 designer can't deal with an abstract base class for a user
control. You should be able to load your ascx page in the designer if you
remove the abstract keyword from the declaration of the base class.

HTH,
Nicole


[quoted text, click to view]

Re: User Control and VS design time issues Munish Sethi
11/3/2003 6:59:57 AM
Nicole,

Thanks for the reply.

Yes,

It was declared as abstract, and I did make the modification for it NOT
to be abstrat however still no luck.

Here is the current situation

User Control look like

<%@ Control Language="vb" AutoEventWireup="false"
Codebehind="CategoriesDetail.ascx.vb"
Inherits="UserInterface.CategoriesDetail" %>

Code Behind file looks like

Namespace UserInterface
Public Class CategoriesDetail
Inherits BaseDetail
...
End Class
End Namespace


Base Class look like

Namespace UserInterface
Public Class BaseDetail
Inherits System.Web.UI.UserControl
...
End Class
End Namespace


Munish

*** Sent via Developersdex http://www.developersdex.com ***
AddThis Social Bookmark Button