Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7586097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:20:27+00:00 2026-05-30T19:20:27+00:00

I have an HTML link that opens a jQuery modal dialog which contains an

  • 0

I have an HTML link that opens a jQuery modal dialog which contains an iFrame. This iFrame contains a form that should close dialog after postback (Ok or Cancel).

In my postback I add a Javascript function to iFrame that closes the dialog and it works fine. However problem is, after user presses Ok or Cancel button, dialog closes and opens again! What am I doing wrong?

Here is my code:

Calling HTML page:

<html>
<head>
    <link rel="stylesheet" type="text/css" href="theme/south-street.css" media="screen" id="themeCSS" />

    <script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
    <script type="text/javascript" src="js/jquery-ui-1.8.16.custom.min.js"></script>
    <script type="text/javascript">
        $(function () {
            $("#dlgConfirm").dialog({
                autoOpen: false,
                resizable: false,
                modal: true,
                width: 550,
                height: 300,
                close: function (event, ui) { alert('closed') }
            })
        });


        function fConfirm(tId) {
            alert('ddd');
            $('#dlgConfirm').children().attr('src', 'ConfirmTracking.aspx?tId=' + tId)
            .load(function () {
                $("#dlgConfirm").dialog('open');
            });
            return false;
        }
    </script>
</head>
<body>
    <div style="display: none">
        <div id="dlgConfirm" title="Confirm Tracking" style="padding: 0px">
            <iframe style="margin: 0px; padding: 0px" marginheight="0" marginwidth="0" src="" width="100%" height="100%" frameborder="0"></iframe>
        </div>
    </div>

    <a href="#" onclick="return fConfirm('109')">Click me</a>
</body>
</html>

iFrame Page

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ConfirmTracking.aspx.cs" Inherits="Chicken.ConfirmTracking" %>
<html>
<head runat="server">
    <script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
    <script type="text/javascript" src="js/jquery-ui-1.8.16.custom.min.js"></script>
    <script type="text/javascript">
        function CloseThis() {
            parent.$('#dlgConfirm').dialog('close');
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <br />
        <asp:TextBox ID="edtTrackingNo" runat="server"></asp:TextBox>
        <br /><br />
    <asp:Button ID="btnOk" runat="server" Text="Ok" />
    <asp:Button ID="btnCancel" runat="server" onclick="Cancel_Click" Text="Cancel" />
    </form>
</body>
</html>

iFrame Codebehind:

using System;

namespace Chicken {
    public partial class ConfirmTracking: System.Web.UI.Page {
        protected void Page_Load(object sender, EventArgs e) {

        }

        protected void Cancel_Click(object sender, EventArgs e) {
            ClientScript.RegisterClientScriptBlock(this.GetType(), "none", "<script>$(function(){CloseThis()});</script>");
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T19:20:28+00:00Added an answer on May 30, 2026 at 7:20 pm

    I managed to trace your problem, the load in function fConfirm(tId) triggers again after closing your dialog. It seems to be a bug. A messy way to fix this is adding a global variable to your page and set it to true to show that dialog is opened via function then before opening your dialog if the variable is true open the dialog. don’t foget to set your variable to false again so you can re-open dialog if it is needed.

    your function will look like below:

        var loadedByFunction = false;
    
        function fConfirm(tId) {
            loadedByFunction = true;
            $('#dlgConfirm').children().attr('src', 'ConfirmTracking.aspx?tId=' + tId)
            .load(function () {
                if (loadedByFunction) {
                    loadedByFunction = false;
                    $("#dlgConfirm").dialog('open');
                }
            });
            return false;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application that contains this code: <script src=Scripts/jquery-1.4.1.min.js type=text/javascript></script> <script src=Scripts/facebox.js type=text/javascript></script>
I have a link on my website which opens a html content from a
I currently have a registration form which when clicked from a link opens up
I have a jQuery dialog that posts a form when the Please Confirm button
I have the following code that simply uses a jquery ui modal dialog to
I have a html.actionlink that i wish to display a link to a members
I have HTML code like this : <div> <a>Link A1</a> <a>Link A2</a> <a>Link A3</a>
I have an html page which has a link called open. Once the link
I have a html like this: <html> <head> <link rel=stylesheet type=text/css media=all href=style.css> </head>
in my code for index.html I use jQuery and have a link with id

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.