Hi! I have created a modal dialog using Jquery and I am opening an aspx page inside the modal dialog. The code is as follows:

ASPX Page:

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

<asp:Content ID="PageHead" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">
<link rel="stylesheet" type="text/css" href="http://7h5nk1s:11261/ecmaomexamples/Scripts/CSS_Files_/jquery.ui.all.css" />
<script type="text/javascript" src="http://7h5nk1s:11261/ecmaomexamples/Scripts/jquery-1.4.4.js"></script>
<script type="text/javascript" src="http://7h5nk1s:11261/ecmaomexamples/Scripts/jquery.ui.core.js"></script>
<script type="text/javascript" src="http://7h5nk1s:11261/ecmaomexamples/Scripts/jquery.ui.widget.js"></script>
<script type="text/javascript" src="http://7h5nk1s:11261/ecmaomexamples/Scripts/jquery.ui.mouse.js"></script>
<script type="text/javascript" src="http://7h5nk1s:11261/ecmaomexamples/Scripts/jquery.ui.draggable.js"></script>
<script type="text/javascript" src="http://7h5nk1s:11261/ecmaomexamples/Scripts/jquery.ui.position.js"></script>
<script type="text/javascript" src="http://7h5nk1s:11261/ecmaomexamples/Scripts/jquery.ui.resizable.js"></script>
<script type="text/javascript" src="http://7h5nk1s:11261/ecmaomexamples/Scripts/jquery.ui.dialog.js"></script>
<script type="text/javascript" src="http://7h5nk1s:11261/ecmaomexamples/Scripts/addaccount.js"></script>
</asp:Content>

<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
<a href="#" id="addaccountlink">Add an account</a>
<a href="http://7h5nk1s:11261/ecmaomexamples/SitePages/testpage.aspx">Redirect</a>
<div id="addaccount" style="display: none; padding: 5px">
<!--<object id="addaccountobject" width="500" height="500" type="text/html" data="http://7h5nk1s:11261/ecmaomexamples/_layouts/TestAppPage/AddToList.aspx"> 
alt : "Close()"
</object>-->
</div>
</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>

addaccount.js file:

$(document).ready(function () {
    $("#addaccount").dialog({
        height: 'auto',
        width: 'auto',
        modal: true,
        autoOpen: false
    });
    
    $("#addaccountlink").click(function (e) {
        $.get('http://7h5nk1s:11261/ecmaomexamples/_layouts/TestAppPage/AddToListv2.aspx', function(response){ 
    	$('#addaccount').html(response); 
    	$('#addaccount').dialog('open'); 
}); 

        
    });
    
    function Close()
    {
    	$('#addaccount').dialog('close');
    }
    
    $(window).unload(function () { alert("Bye now!"); });
});

Please Help!:S

Sorry I forgot to mention the problem. The Page is getting redirected to the page opened in the modal dialog.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.