How to determine if Toolpart is running inside SharePoint Designer
A web part can't use certain objects such as Page.Request as detailed in Best Practice to create desig开发者_Python百科ner friendly server controls when running in a designer such as SharePoint Designer.
You can use the DesignMode property to determine if a web part is running inside a designer and act appropriately.
However this doesn't seem to work for Toolparts - it always returns false.
How do you determine if a Toolpart is running inside SharePoint Designer?
We need the Toolpane.InCustomToolpane property
So from the toolpane code its
this.ParentToolPane.InCustomToolPane
An aside - I think the reason for this difference (though its a poor reason) is that the web part page is loaded into a designer taken from Visual Studio (Whidbey) as mentioned in the msdb blog, but the toolpart is loaded into a browser window.
精彩评论