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.


Published at

Tags: Umbraco,JavaScript

Luke Alderton

Comments

Naufil
Good one.
30/07/2018
Share with
Tags
Latest Comments
By Mark Gentry on Windows Server 2019 - Change product key does nothing
20 Aug 2021, 03:30 AM
By Cathy on In-Place Upgrade for a Windows Server domain controller
31 Jul 2021, 18:28 PM
By Mr. Greymatter on Raspberry Pi - Running Java app on Raspbian
16 Feb 2021, 07:35 AM
By Mikko Seittenranta on Xamarin Forms multiple instances of same app open
16 Feb 2021, 04:34 AM
By Andrew on Auto/Custom height on Xamarin Forms WebView for Android and iOS
22 Jan 2021, 22:15 PM
By Nick on Raspberry Pi - Running Java app on Raspbian
14 Oct 2020, 19:37 PM
By Ivan on Fixed: Value cannot be null Parameter Name: source
15 Sep 2020, 19:47 PM
By Anand on Raspberry Pi - Bluetooth using Bluecove on Raspbian
7 Sep 2020, 16:53 PM
Categories
App Development
Event
Game Development
Mapping
Modelling
Programming
Review
Robotics
Tutorial
Web Development