Sharepoint Forum

 
Home » Forum » Sharepoint       Ask a questionRSS Feeds

JavaScript to open the tool pane

  Asked By: Rocco Hendricks         Date: Apr 21, 2005      Category: Sharepoint      Views: 2652
 

Most of the SharePoint developer will know this. But I just thought of sharing this tip here.

This JavaScript will open the tool pane for that particular web part. Similar to OOTB web parts functionality.
The user doesn't have to click the down arrow of the web part and say modify the web part.

protected override void RenderWebPart(HtmlTextWriter output)
{
EnsureChildControls();
try
{
output.Write("To modify the web part,<a target=\"_self\" href=\"javascript:MSOTlPn_ShowToolPaneWrapper('{0}', '{1}', '{2}');\"> click here to open the tool pane</a>",1,129, this.ID);

Tagged:            

 

3 Answers Found

 
Answer #1       Answered By: Dakota Shaffer          Answered On: Apr 21, 2005       

You can get a bit more functionality  by using the GetShowToolPaneEvent method of the ToolPane class. This method accepts a parameter to determine what is shown in the tool  pane, such as the Web Part Properties, Web Part Gallery, etc.

SDK Documentation is here: msdn.microsoft.com/.../...PaneEvent_SV01014917.asp

Your example requires me to understand what the contants 1 & 129 mean. Using the method about (which is a static method) I can write:

String toolPaneLink = ToolPane.GetShowToolPaneEvent(this,ToolPane.ToolPaneView.Properties);

 
Answer #2       Answered By: Ted Gilmore          Answered On: Apr 21, 2005       

The other tip  I usually use is not allow users to close a custom web  part.

protected override  void RenderWebPart(HtmlTextWriter output)
{
try
{
this.AllowRemove = false;
this.AllowMinimize = false;
this.IsVisible = false;

rest of code
Just wondering what is the purpose of Close in the context menu of web part  property. If I close a web part I can't get it back unless I append contents=1 in the URL.

 
Answer #3       Answered By: Monte Cooley          Answered On: Apr 21, 2005       

If you Close a Web Part, the personalization of that Web Part (including
the Web Part Zone and position of the Web Part on the page), is retained
and the Web Part is placed into the Web Part Page Gallery.

 
Didn't find what you were looking for? Find more on JavaScript to open the tool pane Or get search suggestion and latest updates.


Your Answer
  • Answer should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].