Show modal in custom ASPX page RRS feed

  • Question

  • Ive tried so many ways to get this to work, but nothing is.

    I have a button, and onclick i want it to open a modal to a library/list newitem form. I have tried including these sources:

    Sharepoint:ScriptLink ID="ScriptLink2" Name="sp.js" Localizable="false" runat="server"></Sharepoint:ScriptLink>
    <Sharepoint:ScriptLink ID="ScriptLink1" Name="sp.ui.dialog.js" LoadAfterUI="false" Localizable="false" runat="server"></Sharepoint:ScriptLink>   

    and many different scripts, but none work.

    Does anyone have the steps to get this to work? the closest i got was the modal opened but not as a modal but embedded in the page at the bottom and screwed things up. PLEASEEE HELPPP haha

    tried all of this https://social.technet.microsoft.com/Forums/office/en-US/f0e487d1-bf4a-4e86-87f5-b3a61db2ecb7/issue-calling-spuimodaldialogshowmodaldialogoptions?forum=sharepointdevelopmentprevious


    Friday, May 20, 2016 12:56 PM


  • Hi,

    I'm guessing you are using server side code.

    If so could you try using this : 

     <input onclientclick="javascript:SP.UI.ModalDialog.showModalDialog({ url: '<path>/CustomForm.aspx', title: 'Title' }); return false;" id="btnOpenModal" type="button" value="Open" />


    Samuel Levesque | http://sharepointerie.com | Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    Friday, May 20, 2016 4:59 PM