Thursday, 12 February 2015

SharePoint 2013: Show Modal Popup Window in Application Page

Show Modal Popup Window in Application Page

I want to show the modal Popup window from my application page, for that we need to call the below JS file inside your application page.

<script type="text/javascript" src="//code.jquery.com/jquery-1.11.2.min.js"></script>
<script type="text/javascript" src="/_layouts/15/sp.runtime.js"></script>
<script type="text/javascript" src="/_layouts/15/sp.js"></script>

And the call the Jquery function for modal Popup your application page as below we called:

<script type="text/javascript">
        function showModalPopup() {
            alert('Bala testing on this');
            try {
                var options = {
                    width: 630,
                    height: 500,
                    title: "Edit SR Request",
                    bgcolor: '#000000',
                    url: "/_layouts/15/GridVewSort/Seekopinion.aspx?Reqno=USA&list=countries",
                }
            }
            catch (e) {
            }
            SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options);
            return false;
        }
</script>

If you want to cancel the modal Popup window without refresh your screen. you can use below script in cancel button client click:

<asp:Button ID="btnCancel" runat="server" Text="Cancel"  CssClass="btnclass" OnClientClick="javascript: window.frameElement.commitPopup();" />

No comments:

Post a Comment