Earlier I blogged about how to make use of the new dialog framework in SharePoint 2010. It covered working with Application Pages in the _layouts directory.
What about sandboxed solutions? Can you create custom sandboxed dialogs?
Yes, you can! It involves a little bit of work though.
First of all, you can open any page in the dialog. What we are interested is to open our custom page that is specifically going to serve us only via the dialog (popup). As you might have guessed, we cannot make use of the _layouts folder for application pages in sandbox.
Thanks to Wictor for the blog post which showed how to use custom application pages in sandboxed environment. That is a great start for this blog post.
Our sample is very basic:
1) Add a custom button to the Ribbon to the Calendar list.
2) On button click, show the modal dialog.
3) Close the dialog and show the result.