I am looking to hide the "Upload" button in Asset Selector Dialog and I know Asset Selector Dialog uses Dialog.master in SharePoint. Is there a possibility to attach some custom jQuery/Javascript script which will hide the upload button on Asset Selector Dialog

Note: I don't want to modify OOTB Dialog.master page

The location of Asset Selector Dialog in layouts folder is test/_layouts/AssetPortalBrowser.aspx

Update: I have the script to hide the upload button but I just want to know how to put it in Dialog.Master? The problem is there exist no delegate control in Dialog.master at the moment which I can use to insert script.

1 Answer 1


Have you tried solving the script issue using Custom Action with Location="ScriptLink". It load the javascript on all the site pages and even the dialogs. See I have solved the problem below:

All you need to do is to change the paths accordingly, of course put these custom actions in a feature (Site Collection/Web) :)

  <CustomAction Location="ScriptLink" ScriptSrc="~SiteCollection/_layouts/js/jquery-1.5.2.js" Sequence="105" />

 ScriptBlock="function loadImageUploaderScript() {       
                      var head = document.getElementsByTagName('head')[0];          
                      var script = document.createElement('script');          
                      script.type = 'text/javascript'; 
                      var url = window.location.toString();
                      url = typeof(L_Menu_BaseUrl) != 'undefined' ? L_Menu_BaseUrl : url.substr(0, url.indexOf('/_layouts')); 

                      script.src = url + '/_layouts/js/DefaultUploadOff.js';                          
 _spBodyOnLoadFunctionNames.push('loadImageUploaderScript()');" Sequence="120">

DefaultUploadOff.js file will look like as follows:

jQuery(document).ready(function () {


And if your jQuery doesn't work then you can use the following JavaScript code in DefaultUploadoff.js

var inputs = document.getElementsByTagName("table");
var i = 0;
for (i = 0; i < inputs.length; i++) {
var input = inputs[i];
if (input.id.indexOf('SiteMgr_Upload_ButtonTable') > -1)     
    document.getElementById('SiteMgr_Upload_ButtonTable').style.visibility = "hidden";
  • Oh great man! you are a guru! it is working like a charm :D :D. Many thanks!!!!
    – Geek
    May 22, 2012 at 15:16
  • Glad it helped your cause! May 22, 2012 at 16:27

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.