"Cannot Be Designed" error

  • Thread starter Thread starter Francis Shanahan
  • Start date Start date
F

Francis Shanahan

Folks,
I have a base page which is the grand-daddy of all my pages. It inherits
from System.UI.Web.Page

From this I inherit a layout page.

From this I inherit the individual pages themselves.

The problem: My pages can no longer be brought up in the designer. I'm using
Visual Studio 2002 and these pages are written in asp.NET with the code
behinds in vb.NET.

The ancestors are all just regular .vb classes with no visual components.
Even when I switch my pages back to inherit directly from System.UI.Web.Page
I can't bring them up in the designer. This is a real pain.

Has anyone seen this?

Will upgrading to Visual Studio 2003 fix the bug?

Cheers,
-fs
 
That happens to me and my group from time to time. The only way we have
found around it, is to close all .aspx pages, then studio, and reopen it.
That usually fixes it.

Now if you have the Web Control Library in the same solution I have to
rebuild, then close (close all open pages first), then reopen, then rebuild,
then open the problem pages. That usually fixes it.

Don't know if upgrading will help you, but this usually corrects the problem
for my group.

HTH,

bill
 
Thanks for the response.
In the Basepage, I apply security (enable/disable controls) to the controls
array.
In the Layout page, I remove all controls and add them back to the page
along with the form tag. Fairly standard inheritance scheme.

I've tried the suggestions, nothing seems to fix it.
-fs
 
I'm just enabling/disabling based on a cookie value in the basepage. I'm not
attaching to a thread or any of that.

Here's the thing that makes me think it's studio related: When I modify the
page to inherit from System.UI.Web.Page, I get the error "The base class
"System.UI.Web.Page" cannot be designed. "

Weird right?
 
Are any of the properties in your base page class accessing stuff that
relies on the page context (i.e. the Request or Response object,
User.Identity, etc)? You mentioned using a cookie so that may be the case.
That can cause a problem as VS.NET accesses all properties when opening the
page in design view and throws an exception if you are doing stuff like
that. The workaround is to check for a null context in the offending
properties. For example:

public string MyProperty
{
get
{
// This prevents an exception being reported in design view
if(this.Context == null)
return null;

... do stuff that accesses context-related data ...
}
}
 
Thanks to all who responded.
I believe I've traced the cause of my error to the reference path on the
project.

If I add the following path, I can no longer design inherited forms using
visual studio 2002
C:\WINNT\Microsoft.NET\Framework\v1.1.4322\

If I remove this and hence roll back the default references to the v1.0 of
the framework, all seems hunky dory. I've tried removing and adding this and
it seems fairly consistent. I can only hope this is fixed by my upgrade of
visual studio to 2003 as I'm using v1.1 features of drop down controls and
also XSL apis have changed.

-fs
 
Back
Top