Wednesday 2 July 2014

SharePoint Modal Popup

Open SharePoint Designer
Go to Pages
Create new Webpart Page
It will save in Site pages
You can find page code..
Add jQuery reference.
Add below code in side PlaceHolderAdditionalPageHead

<script src="../style library/jquery.min.js" type="text/javascript"></script>

Remove all code inside PlaceHolderMain

Add below code inside  PlaceHolderMain
<style>#Ribbon{display:none !important;}</style>

Code will be
Add one button
<input type="button" id="buttonEdit" value="Open" />
Add below script inside PlaceHolderMain

<script type="text/javascript">

                $('#buttonEdit').on('click', function (e) {
                    e.preventDefault();
                    var options = { title: '', url: 'Untitled_1.aspx?displaymode=design', width: '300', height: '400', allowMaximize: 'true', showClose: 'true', args: "Some data" };
                    SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options);
        });

</script>