sitecoresitecore8sitecore9

How to create sitecore dialog with XML and ShowModalDialog


I created a CopyToMarkets.XML dialog file based off of the \Dialogs\CopyTo.XML file: enter image description here

And attempting to open the dialog with:

Context.ClientPage.ClientResponse.ShowModalDialog("/sitecore/shell/Applications/Dialogs/Copy To Markets.aspx", "1200px", "700px", string.Empty, true);

It just turns grey and nothing happens.

However when I use ShowModalDialog with Copy To.aspx it shows up fine.

I'm new to sitecore so maybe I'm misunderstanding something but basing my understand of creating content editor ui form this tutorial: https://sitecorejunkie.com/2012/12/12/put-things-into-context-augmenting-the-item-context-menu-part-2/

Let me know if this isn't the correct/modern method of creating new editor dialogs!


Solution

  • I ended up building my url like this:

    string url = Sitecore.UIUtil.GetUri("control:CopyToMarkets");
    
    Context.ClientPage.ClientResponse.ShowModalDialog(url, "400px", "700px", string.Empty, true);