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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:27:25+00:00 2026-06-14T22:27:25+00:00

I have an asp.net usercontrol that I’m using to put a bunch of HTML

  • 0

I have an asp.net usercontrol that I’m using to put a bunch of HTML and Jquery logic into to be shared on several pages. This usercontrol has some dropdown boxes loaded from json calls and has no added codebehind logic.

When I use this usercontrol on a normal page it works perfectly fine, and no issues at all.

However, when I wrap the usercontrol in a div, and use a jqueryUI modal dialog, everything in the usercontrol fires twice. Not only code in the initial $(document).ready(function() {});, but also every function is also fired twice when called.

Debugging this in Visual Studio, I see that everything is first being called from the external JS file, and then again from a “script block” file that is somehow getting generated on the fly.

This script block file isn’t getting generated on a page that doesn’t wrap the user control in a modal.

The same happens if I use IISExpress or IIS7.

The question is, why is this script block file getting created, and why is all my jQuery logic firing twice?

–edit–

Here is the div:

  <div id="divMyDiv" title="MyDiv">
     <uc1:MyUserControl runat="server" ID="MyUsercontrol" />
</div>

Here is the modal logic that uses it:

        $("#divMyDiv").dialog({
            autoOpen: false,
            height: 400,
            width: 400,
            modal: true,
            open: function (type, data) {
                $(this).parent().appendTo("form");
            }
        });

Note: The problm still occurs, even if I remove the “open:” function. But, it does not occur if I remove the entire dialog block, so it is specific to this dialog call.

  • 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-06-14T22:27:26+00:00Added an answer on June 14, 2026 at 10:27 pm

    I was able to determine what was going on.

    The link to the external JavaScript file was within the user control itself. Moving this link out of the user control and into the main page fixed it.

    For whatever reason, this stopped that dynamic script block file from getting generated, and as a result, also stopped calling every function twice.

    I just need to remember to add this JavaScript link to every page that uses this user control, or add it to my master page.

    If anyone understands why this happens, I would love to know.

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

Sidebar

Related Questions

I have an asp.net UserControl that writes HTML content from a SharePoint list to
I have an asp.net usercontrol that contains a jQuery UI Dialog Control. All works
I have created my first asp.net UserControl that I will use in several places
I'm working with ASP.NET MVC and jQuery and I have a UserControl that is
I have an ASP.NET web form that has a container usercontrol that hosts several
I have an ASP.NET usercontrol that implements the ValidationProperty attribute. This attribute successfully makes
I have a partial view (UserControl) that implements a simple pager in my Asp.Net
I have a usercontrol that is in an asp.net page that contains a button.
I have asp.net usercontrol that is including some js script like this <script type=text/javascript
I have an ASP.Net application that has a UserControl that needs to be rendered

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.