WebControl with VS2008

  • Thread starter Thread starter ikari
  • Start date Start date
I

ikari

Hello,

I have a webcontrol that works perfectly in VS2005, but breaks during
design-time in VS2008. The error message is:
Unable to cast object of type Microsoft.Web.Design.DocumentDesigner to
System.Web.UI.Design.WebFormsRootDesigner.

The control's design time inherits
System.Web.UI.Design.ControlDesigner.

Does anyone have any idea what's going on here, or what was changed in
Orcas in relation to design time for controls?

Thanks.
 
Hi,

type name "Microsoft.Web.Design.DocumentDesigner " refers that this is
something probably being worked out while beta 2 was released. These usually
end up in System namespace when they're in release condition so I'd bet it
is in shape in RTM. However, I have contacted my peers to ensure the case.
 
This is what I got

Neither in Beta2, nor now, could you have cast a DocumentDesigner to
WebFormsRootDesigner.



My first guess would be that the user's control gets an object that
implements some interface (maybe IWebFormsDocumentService,
IResourceUrlGenerator, or IContentResolutionService), where in Whidbey it
was the WebFormsRootDesigner that implemented that interface. That would
make the cast possible but not advised. Those interfaces are now implemented
by the DocumentDesigner, so the cast wouldn't work in VS2008.



If the user is trying to get the WebFormsRootDesigner, the correct way to do
it would be to get the IDesignerHost, and then do this:



IDesignerHost designerHost =
Component.Site.GetService(typeof(IDesignerHost)) as IDesignerHost;

WebFormsRootDesigner rootDesigner =
designerHost.GetDesigner(designer.RootComponent) as WebFormsRootDesigner;
 
Back
Top