Open SharPoint Show Modal Dialog from Server Side on Clientclick Event

In this bog we will discuss opening the SharePoint and showing the Modal Dialog from the server side on the clientclick event.

<asp:imagebutton id="imagebtnTestDemo" runat="server" imageurl="~/_layouts/images/settings.png" ToolTip="SP.UI.ModalDialog.showModalDialog" TabIndex="4" />

 

protected void Page_Load(object sender, EventArgs e)

{

try

{

    string Url = "/_layouts/TestDialogPage.aspx&Source=/SitePages/Test.aspx";

    imagebtnTestDemo.OnClientClick = "javascript:" +

    " var options = {" +

    " url: '" + Url + "'," +

    " title: 'DialogPage'," +

    " allowMaximize: true," +

    " showClose: true," +

    " width: 800," +

    " height: 600" +

" };" +

"SP.UI.ModalDialog.showModalDialog(options);";

}

catch (Exception ex) { HandleException(ex); }

} 

Ebook Download
View all
Learn
View all