2

I have a modal window which gives me a Server Error in '\' Application when I click it.

The .aspx looks like this:

<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint,     Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ChangeEmail.aspx.cs" Inherits="GOToolkitFeatures.Layouts.ToolkitTilskud.Notification.ChangeEmail" DynamicMasterPageFile="~masterurl/default.master" %>

<asp:Content ID="PageHead" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">
PageHead
</asp:Content>

<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
Main
</asp:Content>

<asp:Content ID="PageTitle" ContentPlaceHolderID="PlaceHolderPageTitle" runat="server">
Application Page
</asp:Content>

<asp:Content ID="PageTitleInTitleArea" ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea" runat="server" >
My Application Page
</asp:Content>

And this is the .js where it's called from:

function ChangeEmailAction(pageUrl) {

var options = {
    title: "Skift email",
    url: pageUrl + "/_layouts/15/toolkittilskud/Notification/ChangeEmail.aspx",
    height: 600,
    width: 800,
};

SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options);
}

If I put a console.log in there, I can see that the function is hit, but something goes wrong. What am I doing wrong here? Any hints appreciated.

1 Answer 1

1

The issue is most likely with the URL you are using for the Dialog. The variable you are passing is named pageUrl if this really is the page url like:

http://somedomain.local/sites/yoursite/pages/yourpage.aspx

then the new url is just going to be that plus the /_layouts/ portion. So something like:

http://somedomain.localsites/yoursite/pages/yourpage.aspx/_layouts/15/toolkittilskud/Notification/ChangeEmail.aspx

This will definitely throw a 500 error as that is not correct. You are wanting your siteUrl rather than the pageUrl. You can verify if this is the issue by using console.log(options.url); before the SOD call.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.