views:

60

answers:

2

Is there a way for a web part to figure out the hosting page is being loaded into SharePoint Designer ?

+1  A: 

Assuming WSS 3.0 / MOSS 2007, Yes:

SPContext.Current.IsRemoteAuthoringTime

or, depending on your context,

SPContext.Current.IsDesigntime

Update: A cruder way might be to peek at the HttpRequest headers - I'm sure SPD sents a header.

-Oisin

x0n
SPContext.Current.IsDesignTime worked for me. Thank you !
Leonidius
+1  A: 

Check the web part control's DesignMode property—it's true if it's open in SPD. This should work for all ASP.NET controls.

Morbo