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
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 AEndumpbub on Reducing Umbraco memory usage by enabling 32-bit applications
13 Oct 2018, 07:04 AM
By nseo-sw.men on MVC forms in Umbraco
12 Oct 2018, 11:30 AM
By JM on Solved: You need to use a Theme.AppCompat theme (or descendant) with this activity
10 Oct 2018, 13:36 PM
By praveen on Xamarin Forms - Working with threads
5 Oct 2018, 12:05 PM
By Jasonced on MVC forms in Umbraco
27 Sep 2018, 05:41 AM
By Евгения on MVC forms in Umbraco
27 Sep 2018, 02:47 AM
By Wokeq62 on Using SQL DataTables to speed up database performance
25 Sep 2018, 17:28 PM
By AnubisMus on MVC forms in Umbraco
24 Sep 2018, 16:54 PM
Categories
App Development
Event
Game Development
Mapping
Modelling
Programming
Review
Robotics
Tutorial
Web Development