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

I did some looking around and I was planning on creating the following js function to open a custom page in a dialog:

     //Handle the DialogCallback callback 
          function DialogCallback(dialogResult, returnValue){ 
          } 

      //Open the Dialog 
      function OpenDialog(url){ 
       var options = { 
            url:url + "?IsDlg=1", 
         width: 700, 
         height: 700, 
         dialogReturnValueCallback: DialogCallback 
         };
     SP.UI.ModalDialog.showModalDialog(options);
     return false;
      }

Is this the right way to do this? I thought I had read somewhere that I could just add the IsDlg query string parameter to make this happen, but this does not appear to work.

share|improve this question

3 Answers 3

I guess we haven't established whether or not you are actually able to see a dialog window open, or whether it looks like a full page when it opens, and not a dialog window.

If it's the latter, when you are calling your OpenDialog function, does the url you are passing already contain a query string?

For example

OpenDialog("/_layouts/custompage.aspx?someparam=1");

If so, I'm not sure the "?IsDlg=1" that you are appending will work. If the url you are passing to OpenDialog already contains a querystring, you would need to append "&IsDlg=1" instead.

share|improve this answer

With the Custom Dialog you have two things; the caller which includes the javascript code you included and then the page that is loaded in the dialog. The code you provided would load the given page in a dialog. Typically that is stored separately from the calling page.

As @andrew.petersen15 noted, the IsDlg=1 is just used to change the way the page is rendered and strips off many of the page objects such as the ribbon and nav since they do not apply within a dialog.

share|improve this answer

That is the only way I have seen. From what I understand , the "IsDlg=1" querystring parameter strips the ribbon and navigtion controls off the page, but doesn't actually create the dialogue box.

share|improve this answer

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.