Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Modify context menu of a web part

  Asked By: Benny    Date: Dec 17    Category: Sharepoint    Views: 3745

How can I hide "Minimize" and "Close" option from context menu of a web part. Do I have to add some code in ows.js file.
If yes how can I achieve this.

Here is an example to do it for documents libraries and lists.




11 Answers Found

Answer #1    Answered By: Marty Mcdowell     Answered On: Dec 17

If you want to stop general users from closing and minimizing a web  part, you can control that in the web part  tool pane. If you do a Modified Shared Web Part, pull up the tool pane and under Advanced are checkboxes to allow closing and minimization.

Answer #2    Answered By: Dakota Shaffer     Answered On: Dec 17

If I want this functionality in all the web  parts what do I need to look for in ows.js file. I also know how to do in custom web parts in .NET but don't know how to do that in OOTB web parts.

Answer #3    Answered By: Ted Gilmore     Answered On: Dec 17

Sorry I am not a JavaScript guru. The functions for those actions don’t appear to be in the OWS.js file, so you would need to track them down or write something that will override the existing functions I would assume. The OOTB web  parts are locked down pretty tight and you usually can’t make any changes to them.

Answer #4    Answered By: Monte Cooley     Answered On: Dec 17

Thank for your contribution to this SharePoint group. You have been a great help to us and thank you for your advice for corporate branded My Site.

I came with a solution to not let the users delete a web  part. This was for My Site default.aspx file. I told the administrator to put all the web parts that need no further modifications in one web part  zone. Eg. Middle right zone. Then I looked for the entry for this zone in default.aspx file  and set the following web part zone property AllowPersonalization="true" to false. Now the web part cannot be minimized, close  or deleted. It behaves as if it is outside the zone.
I know this is not a correct solution but it works for them.

Question: How can I add/create a new web part zone without using FrontPage ?
Second We want a particular web part to available to users by default when they create My Site. They don't have to drag that web part. This can be done easily using FrontPage but the pages will be un-ghosted.

Answer #5    Answered By: Guadalupe Bullock     Answered On: Dec 17

I have a quick post on the WebPartZone properties that can be used to prevent folks from moving/changing web  parts through the UI. It’s at thorprojects.com/blog/archive/2005/09/12/224.aspx Be aware that these appear to be implemented in the UI and the web service and object model calls still appear to work even with these set.

To get a new web part  zone you need to change the site definition. You can find out more here: http://www.devx.com/dotnet/Article/27673/0

Answer #6    Answered By: Nathanial Mcclure     Answered On: Dec 17

I am able to add  a web  part zone without making the page un-ghosted.

This is what I did I created a new web part  page with web part zones in it. Then I open the same page using FrontPage. Looked for a particular web part zone. For example  we don't have header web part zone in My Site. So I copied the entry of Header zone from the new web part page and added to the default.aspx page of My Site. Now I see a new zone in default.aspx page of My Site.

Then I closed the new web part page and did not save it. So all the pages are still ghosted.

Answer #7    Answered By: Matt Prince     Answered On: Dec 17

I don’t think any solution is an incorrect solution.

As for the web  part zone, open up the page in an editor (Notepad, etc) and locate a web part  zone user control. Copy and paste it where you need the new zone and change the attributes to be unique. This is what you will be looking for:

<WebPartPages:WebPartZone runat="server" AllowPersonalization="true" ID="BottomZone" Title="Bottom Zone" Orientation="Vertical"/>

The zones are organized in a table so you may need to add  a new table row or something depending on your UI needs.

If you login as administrator and edit the Shared view of your My Site, it will affect all personal sites for users. You can try that method for adding the web part by default for all My Sites.

Answer #8    Answered By: Brooks Bond     Answered On: Dec 17

That means if I login as an administrator and add  a web  part in the Shared view. Now a new user creates My Site. This user will have that web part  visible by default on his/her My Site.

Answer #9    Answered By: Gregg Wilkinson     Answered On: Dec 17

Yes. New My Sites and existing My Sites.

Answer #10    Answered By: Darrel Sexton     Answered On: Dec 17

Maybe it will help to understand this behaviour if you examine the two different
technologies that appear to be one "My Site."

The public and private pages of "MySite" are really presented by the MySite
area. Check out the URL.

All of the collaborative features of "MySite" a part  of a Top Level site
collection created for each user who has the right to create personal sites.

These (essentially) WSS sites are created in the personal managed path. Check
the URL for Shared Documents or Private Documents.

So, when you modify  the shared view, you are modifying the default page of the

Answer #11    Answered By: Tory Sellers     Answered On: Dec 17

Setting the properties of the Web Zone in the direct-mode page is an
effective way to lock down a given set of Web Parts. But sometimes the
properties of the Web Zone don't seem to be set when the direct-mode
page has already been created. I haven't played with this enough to give
specific guidelines but I can say that some experimentation will be in

Didn't find what you were looking for? Find more on Modify context menu of a web part Or get search suggestion and latest updates.