3

I want to edit document library webpart to change Toolbar Type to 'No Toolbar' programmatically using C#. Actually I want to hide 'add new document' button.

enter image description here

I have created a document library programmatically.

3
  • If the requirement is to simply hide the "Add new document" link, then this can also be done by using JQuery/Javascript code. I can provide the JQuery code if you need. Dec 17, 2014 at 6:35
  • if you want to only hide the Add new Document link you can do it by adding a CEWB and take the class name of add new link and code in css as display:none. Also you can go to the SharePoint designer and edit the view, you will find an option toolbar there set is no toolbar it will hide the link. Dec 17, 2014 at 6:40
  • @ Nadeem, @ Akarsh , I am creating document library programmatically. So I want that when it creates its toolbar type to be set as 'No'. @ Nadeem .. please provide JavaScript code here, then I will thought about that. Dec 17, 2014 at 7:03

1 Answer 1

0

@Ronak, here is the script:

<script type="text/javascript">
        $(document).ready(function () {
            // Hide all Add new button links on the page. 
            $('[id^="Hero-WPQ"]').hide();
        });
</script>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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