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 7568523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T14:56:52+00:00 2026-05-30T14:56:52+00:00

I am trying to create a popup dialog with CodeBehind Events and JavaScript events.

  • 0

I am trying to create a popup dialog with CodeBehind Events and JavaScript events. I have created a button that launches the following dialog. That works fine.

<script type="text/javascript">

    function ShowDialog(aPage, aWidth, aHeight, aTitle) {
        var $popupURL = aPage;
        var $popupDv = $("#resultDiv");

        jQuery.ajax({ url: $popupURL,
            cache: false,
            success: function (html) {
                $popupDv.empty().append(html);

                $popupDv.dialog({
                    width: aWidth,
                    height: aHeight,
                    modal: true,
                    title: aTitle,
                    draggable: false,
                    resizable: false
                });
            }
        });
    }

</script>

Button Code:

<form id="form1" runat="server">
<div>
    <div id="resultDiv">
    </div>
    <input id="Edit1Button" type="button" value="Edit 1" onclick="ShowDialog('edit3.aspx?ID=1', 600, 400, 'Hello Edit 1')" />
</div>
</form>

Keep in mind this is just test code.. OK so after I click the button a dialog pops up. In the dialog, I have the following code..

<form id="form2" runat="server">
<div>
    <h1>
        Edit Dialog 3</h1>
    <asp:Button ID="CloseButton" runat="server" Text="Close" OnClick="CloseButton_Click"
        OnClientClick="$('#resultDiv').dialog('close'); return true;" />
</div>
</form>

if I have return false, then just the javascript OnClientClick fires and the dialog closes.. Works as expected. if I set return true the dialog closes but this is where the issue is. the main form disappears and is replaced by the dialogs form..

I need this button to execute the CloseButton_Click in codebehind then close the dialog. I am VERY new to asp.net and C# so be gentle with your responses.. like weeks

Thanks
Anthony

  • 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-30T14:56:53+00:00Added an answer on May 30, 2026 at 2:56 pm

    What is happening is that since your child form (Edit3.aspx) is posting back to the webserver, ASP.NET is sending back the response for Edit3.aspx – not your initial form. In order to accomplish what you want, you will have to use an asynchronous postback to the server. This can be accomplished by changing your Edit3.aspx form to the following:

    <form id="form2" runat="server"> 
    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
    <div> 
    <h1 runat="server" id="edit3"> 
        Edit Dialog 3</h1> 
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
    <asp:Button ID="CloseButton" runat="server" Text="Close" OnClientClick="$('#resultDiv').dialog('close'); return true;" /> 
    </ContentTemplate>
    </asp:UpdatePanel>
    </div> 
    

    The ScriptManager control and the UpdatePanel control allow your form to post back to the server asynchronously.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create popup using the jqueryui dialog. I am trying to
I'm trying to create a dynamic popup window that is able to be re-sized.
I'm trying to create a wx.Menu that will be shared between a popup (called
I have a simplr svg-graph and I'm trying to create a simple tooltip-popup for
I have a popup I want to create that will have 3 choices. (Block,
I am trying to create a popup when my link is clicked. I have
I am trying to create a hint dialog box that informs the user about
I'm trying to create a popup menu, where I can detect the mouse button
I'm trying to create a popup window that only appears the first time the
(Java SE 6) I'm trying to create a pop-up dialog that displays a please

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.