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.

  • 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. – Nadeem Yousuf Dec 17 '14 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. – Akarsh Gupta Dec 17 '14 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. – Ronak Patel Dec 17 '14 at 7:03
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, privacy policy and cookie policy

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