Issues when trying use the ModalDialog.Close() method

« Back to message list

Enter your email address to get email updates on this topic. You can stop receiving updates by clicking the link in the update email messages.

Posted by John C on 14th June 2017
Well, you helped me so much with ModalDialog.Open(). Maybe now you can help me with ModalDialog.Close()! :)

I've got my Dialog opening in a javascript function like this:

ModalDialog.Show('string:<div id="outerdiv"><iframe id="ReleaseIFrame" name="ReleaseIFrame" src="/Home/Stores...

In my View, I have a button that should close it (and I've added the core and ModalDialog scripts to the page):

<button id="BtnCloseIFrame" type="button" class="btn button-alt-1 button-v"


Unfortunately, the button click is doing nothing. Any ideas why this would be failing?

- John C
Posted by Richard on 14th June 2017
Hi there,

Don't try and use the method from the page that's inside the frame - it might be feasible but since it's essentially a whole different page it won't be as easy as adding a close button to the dialog itself, which I've done with the example.

You can also just press the ESC key.

Posted by John C on 14th June 2017
Thank you, I never would have thought of that. It seems the simplest way is to change my button-click to mimic what an ESC key does - I'll try both methods.

- John C
Posted by John C on 15th June 2017
Putting the close modal button outside the IFrame seems to work best. One question, though:

Within the iframe at the top of that section, there's this big blank area I can't get rid of. I don't even know what part of the iframe it belongs to. I put a background color on the iframe, and it doesn't show that in the blank area. I tried using the same background color for the ModalDialog_topbar, just in case that was the culprit, but it was not. Do you know how to get rid of that area?

- John C
Posted by Richard on 15th June 2017
Hi there,

Most likely its a padding and/or margin setting - which it may have inherited from a CSS rule that you didn't expect it to.

So you'll need to inspect the frame and use the tools there to find it.

For example on this example:

You can inspect the IFRAME and then deselect the margin that I've set and it will remove the margin from it.


Add a reply

« Back to message list