Friday, October 19, 2012

Hide Ribbon Controls

Hi Guys,

Yesterday I was working on an application in MS SharePoint 2010 and there I come up with a task where I had to hide "New Item" and "Edit Item" Controls from the SharePoint Ribbon Menu. To do so we need to embed the below given code in the 'Content Editor Web Part'.

Given are the following steps that may help us in hiding the Add Item and Edit Item controls.

Edit SharePoint Page on which you need to hide the controls for that goto Site Actions >> Edit Page. This will open the page in the Edit mode where you need to add a web part by Clicking 'Add a Web Part'. Then from the categories select 'Media and Content' and from the sub-categories of Web Parts select 'Content Editor'

Content Editor Web Part
Media and Content >> Content Editor Web Part

After adding the Content Editor Web Part you need to edit the HTML Source as being shown in the below given screen print.

Edit Content Editor Web Part
Edit HTML Source of Content Editor Web Part

This will open a new window in which you need to paste the below given JavaScript.

<style type="text/css">
#Ribbon\.ListItem\.New\.NewListItem-Large
{
display:none;
}
</style>

<style type="text/css">
#Ribbon\.ListItem\.Manage\.EditProperties-Large
{
display:none;
}
</style>





I believe the above given post can help you too to Hide the Add Item and Edit Item Menu from the Ribbon Control. I am sure that this may work for you but if still you face any issue then you can drop me an email with the issue you are getting at mail@amitmathur[dot]in.

No comments:

Post a Comment