Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

How do I hide the "Datasheet view" option (under "View Format") in a list's ribbon menu?

share|improve this question
add comment

4 Answers

Q: Have you tried simply unchecking the "Allow items in this document library to be edited using the datasheet?" to NO

share|improve this answer
    
I believe that's the front-end counterpart to SPList.DisableGridEditing, and hence also 2010-specific. –  Stuart Pegg Oct 4 '12 at 14:47
add comment

You could use javascript to do this.

var menuItems = document.getElementsByTagName('ie:menuitem');
for (i=0; i<menuItems.length; i++)
  if (menuItems[i].text == 'Edit in Datasheet')
    menuItems[i].removeNode();

jQuery version:

$("ie\\:menuitem[text='Edit in Datasheet']").each(function() {
    this.hidden = true;
});
share|improve this answer
add comment

In addition to Steve B's solution, another 2010-only way of doing this is to set the following property to true:

SPList.DisableGridEditing

Unfortunately there appears to be no way to do this in 2007.

share|improve this answer
add comment

As described in this article : Remove button from the Ribbon in SharePoint 2010, you can, with a feature, remove existing button.

In your case, the feature.xml file should be :

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomAction
    Id="RemoveDataSheetButton"
    Location="CommandUI.Ribbon"
    RegistrationType="List"
    RegistrationId="101">
    <CommandUIExtension>
      <CommandUIDefinitions>
        <CommandUIDefinition
          Location="Ribbon.List.ViewFormat.Datasheet" />
      </CommandUIDefinitions>
    </CommandUIExtension>
  </CustomAction>
</Elements>
share|improve this answer
    
Aha! Changing the 'Library' in the Location to 'List' allows it to work for lists (with the appropriate RegistrationId). Thanks for your help. I'll award the bounty once the 24 hours have passed. –  Stuart Pegg Jul 19 '11 at 13:25
    
edited :) thx for your hawk eyes –  Steve B Jul 19 '11 at 13:45
2  
Word of warning to others using this: it seems to only be compatible with 2010. –  Stuart Pegg Jul 22 '11 at 10:19
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.