WebControl with VS2008

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.
 
T

Teemu Keiski

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.
 
T

Teemu Keiski

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;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top