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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T23:39:14+00:00 2026-05-21T23:39:14+00:00

i got stuck with jquery modal dialog. my modal shows by clicking twice on

  • 0

i got stuck with jquery modal dialog. my modal shows by clicking twice on the button and spoils the markup also on the page
i read no of posts including stack overflow
this

AND this

but my issue doesn’t match both.So i request you to please not vote down the question.

i am using the following code to show modal

<script type="text/javascript">

        function overlayclickclose() {
            if (closedialog) {
                jQuery('#mydialog').dialog('close');
                             }
            closedialog = 1;
                                    }

            jQuery('#mydialog').dialog({
            bgiframe: true,
            autoOpen: false,
            modal: true,
            width: 900,
            height: 400,
            resizable: false,
            open: function() { closedialog = 1; jQuery(document).bind('click', overlayclickclose); },
            focus: function() { closedialog = 1; },
            close: function() { jQuery(document).unbind('click'); }
            });
            </script> 

now here is my div to be shown as popup

<div id="mydialog"><NL:TemplatePicker ID="TemplatePicker1" Runat="server"></NL:TemplatePicker></div>

And i am calling the modal on Click of a button by calling it in asp.net code behind like this

protected void btnChooseTemplate_Click(object sender, EventArgs e)
    {
        ScriptManager.RegisterClientScriptBlock(this.Page, Page.GetType(), "change", "jQuery('#mydialog').dialog('open');closedialog = 1;jQuery('#mydialog').parent().appendTo(jQuery('form:aspnetForm'));", true);
    }

my page uses ajax updatepanel.

any help would be regarded. if you need anything more to knowthe problem better let me know.

Thanks

  • 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-21T23:39:15+00:00Added an answer on May 21, 2026 at 11:39 pm

    @Devjosh: It looks like you are registering the open dialog in the btnChooseTemplate click. This means the open script will not be registered until after the first click. Try moving the client script block registration into the page load function so that it’s registered each time your page loads, ready for the first click each time.

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

Sidebar

Related Questions

I am creating an jquery ajax application.. where i got stuck And i uploaded
I got stuck when chmod a file. At the bottom of this page ,about
So I got stuck in this dead end. I have AJAX script and jQuery
Morning/Afternoon guys. Writing some JQuery AJAX shizz and getting a bit stuck. I've got
I got my form in jQuery ui dialog and I apply client-side validation in
I'm new to jQuery and I have got stuck on an each loop. I'm
Hi I am fairly basic in jQuery, and got stuck in a script: //hide
I'm beginning with php, jquery and Slim PHP framework and I got stuck in
I'm trying to open a jquery modal dialog box when the user clicks on
I am stuck when I am clicking the submit button. On clicking the submit

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.