Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

SCRIPT5007: Unable to get property 'commonModalDialogClose' of undefined or null reference

$
0
0

Hi guys, 

can anybody help me, please. I want to close an custom aspx-Dialog in SharePoint 2013, but it doesn't work. 

I have implemented the following code: 

Dialog.aspx:

<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server"><asp:Label runat="server" ID="LabelInfo" Text="An aspx dialog" /><br/><br/><asp:Button runat="server" ID="Button1" Text="OK" Font-Size="8" OnClick="ButtonOK_OnClick" style=";  " /></asp:Content>

Dialog.aspx.cs:

public partial class Dialog : LayoutsPageBase
{
	protected void Page_Load(object sender, EventArgs e)
	{
		// nothing implemented here cause of no need
	}

	// here comes the function for closing the aspx dialog
	protected void ButtonOK_OnClick(object sender, EventArgs e)
	{
		string[] isDlg = this.Request.QueryString.GetValues("IsDlg");

		if (isDlg != null && (isDlg.Count() == 1 && isDlg[0] == "1"))
		{
			Page.ClientScript.RegisterStartupScript(this.GetType(), "PopupScript", "SP.UI.ModalDialog.commonModalDialogClose(1, 1);", true);
		}
	}
}

I have also tried:

protected void ButtonOK_OnClick(object sender, EventArgs e)
{
	Page.ClientScript.RegisterStartupScript(this.GetType(), "PopupScript", "SP.UI.ModalDialog.commonModalDialogClose(1, 1);", true);
}

So, where is the problem? In SharePoint2010 it has worked.

Kind regards, 

ryo998



Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>