How to open a modal window for a custom datatype in the Umbraco back office

Opening a modal window in the back office of Umbraco, is easy using the example code below, just bare in mind that the modal window isn't like a bootstrap modal window in the sense that bootstrap opens its modal windows in a relatively square box on top of the content. Umbraco instead opens its modal windows as a content area on the right hand side of your screen.

Example Code:

<a href="javascript:UmbClientMgr.openModalWindow('/App_Data/mycustomfolder/myfile.html', 'Modal Window Example Title', true, 500, 400,0,0,'', callbackFunction();" title="Modal window">Open my Modal window</a>

Example Output:

Example Umbraco Modal Window

Further reading:

Be aware that this will open a web address as if it were a proper modal window i.e. you could load http://www.google.co.uk/ into it and it would load just fine in the side bar. As such, any local file you open will need to be a complete .html file with all standard html tags as if it were a standalone page.

If you're looking to open it as a dialog window so that you can parse data to and from the page without having to declare all the html around it, you'll need to read up on the dialogService.

In case you're interested, I've written an article on opening dialog windows and how to parse data between them.


By Luke Alderton at 28 May 2017, 07:43 AM

Tags: Umbraco,JavaScript

Comments

Post a comment
Sit tight...
We're adding your comment.
Thank you.
Your comment has been added.
There's been a problem.
Please try again later.
Share with
Tags
Latest Comments
By dipbleds on Raspberry Pi - Bluetooth using Bluecove on Raspbian
12 Dec 2017, 21:29 PM
By Ich on Replacing the Xamarin Header/Navigation bar with a custom view/template
26 Nov 2017, 17:11 PM
By Ravi Motha on My experience at Umbraco UK Festival 2017
12 Dec 2017, 08:39 AM
By Borges on How to add a Xamarin Forms Loading Screen/Overlay
7 Nov 2017, 19:11 PM
By Rutul Mehta on Auto/Custom height on Xamarin Forms WebView for Android and iOS
4 Nov 2017, 03:15 AM
By Pablo on Xamarin MasterDetailPage has large margin/padding at top
26 Oct 2017, 15:31 PM
By faiza on Using MaryTTS or OpenMary in Java
22 Oct 2017, 12:54 PM
By Nietoperz on Using MaryTTS or OpenMary in Java
29 Sep 2017, 14:34 PM
Categories
App Development
Event
Game Development
Mapping
Modelling
Programming
Review
Robotics
Tutorial
Web Development