Share via


Remove Web Part ToolParts

Sometimes it is required to remove all ToolParts from your web part to prevent any customization from users. 

To do this, you must inherit your web part from   Microsoft.SharePoint.WebPart.WebPartPages.WebPart  (not  System.Web.UI.WebControls.WebParts.WebPart)

In your web part class, you can override the GetToolParts()   event and essentially add "no" toolparts.

....web part codepublic override ToolPart[] GetToolParts(){     ToolPart[] toolparts = new ToolPart[0]; //empty array          //add your own tool parts here           return toolparts;}