Add a Edit This Webpart link from within a web part in SharePoint
Add a Edit This Webpart link from within a web part in SharePoint by adding the following javascript to your web part output:
javascript:MSOTlPn_ShowToolPane2Wrapper('Edit',this,'"+ this.ID +"');
Here's a sample of how you would do this in the CreateChildControls method:
protected override void CreateChildControls()
{
Controls.Clear(); base.CreateChildControls();
StringBuilder sbOut = new StringBuilder();
Literal ltlOutput = new Literal();
if (SiteURL == null || SiteURL == "")
{
sbOut.Append("Please <a href=\"javascript:MSOTlPn_ShowToolPane2Wrapper('Edit',this,'"+ this.ID +"');\">modify this web part</a> and set the web site where the list data is or will be stored.");
}
ltlOutput.Text += sbOut.ToString();
Controls.Add(ltlOutput);
}
Source:
http://blogs.msdn.com/b/cliffgreen/archive/2008/03/17/create-open-tool-pane-link-in-asp-net-2-0-web-parts-for-sharepoint.aspx
javascript:MSOTlPn_ShowToolPane2Wrapper('Edit',this,'"+ this.ID +"');
Here's a sample of how you would do this in the CreateChildControls method:
protected override void CreateChildControls()
{
Controls.Clear(); base.CreateChildControls();
StringBuilder sbOut = new StringBuilder();
Literal ltlOutput = new Literal();
if (SiteURL == null || SiteURL == "")
{
sbOut.Append("Please <a href=\"javascript:MSOTlPn_ShowToolPane2Wrapper('Edit',this,'"+ this.ID +"');\">modify this web part</a> and set the web site where the list data is or will be stored.");
}
ltlOutput.Text += sbOut.ToString();
Controls.Add(ltlOutput);
}
Source:
http://blogs.msdn.com/b/cliffgreen/archive/2008/03/17/create-open-tool-pane-link-in-asp-net-2-0-web-parts-for-sharepoint.aspx
Comments
Post a Comment