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

The Archive Base Latest Questions

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

I feel really dumb for asking this question, but here it goes. I have

  • 0

I feel really dumb for asking this question, but here it goes. I have an asp.net page that may (or may not) load text boxes on the page with Ajax depending on if certain checkboxes and other conditions are met. I also need these boxes to be hidden given certain conditions. For the use case where the text boxes are on the page during the load having my jquery in the document ready does the trick. For the other use case where the text boxes are loaded with a particular user action, the code in document ready will have no effect. I ended up taking the bulk out of document ready and placed it in its own function called “setup” which I can call after the text boxes have been loaded.

So here is the problem: I can’t figure out how to have the page call setup after those text boxes are loaded. I can’t use .ajaxComplete() (probably because asp.net isn’t using jquery to load those boxes) nor can I think of any other way to call setup at the right time. The only thing I could think of was to have the page call setup on mouseover.

This is unnecessarily greedy and frankly just really bad code. Is there an easy way to call “setup” once after those boxes are loaded?

      jQuery(document).ready(function() {
        setup("ready");

      });

      function setup(action)
      {
        if(action=="ready" || $("#<%=CurrentInventoryMode.ClientID %> option:selected").val()==1)
        {
         if(!$('#<%=AllowSub.ClientID %>').is(':checked'))
        {
            $('#<%=InStockUnits.ClientID %>').hide();
            $('#<%=LowStockUnits.ClientID %>').hide();
            $('#SellAsSpan').hide();
            $('#<%=SellAsUnit.ClientID %>').hide();
        }
        if($("#<%=SellAsUnit.ClientID %> option:selected").val()==4)
        {
            removeWeight();
        }else{
            removeMeasure();
        }
        }
       }

       $('body').mouseover(function()
       {
       //there has GOT to be a better way....
        setup();
       });

EDIT:
Here is the part of the code that does the ajax call. Its an ajax update panel

<ajax:UpdatePanel ID="InventoryAjax" runat="server" UpdateMode="conditional">
            <ContentTemplate>
                <asp:DropDownList ID="CurrentInventoryMode" runat="server" AutoPostBack="true" OnSelectedIndexChanged="CurrentInventoryMode_SelectedIndexChanged" onclick="setup();">
                    <asp:ListItem Value="0" Text="Disabled"/>
                    <asp:ListItem Value="1" Text="Track Product"/>
                    <asp:ListItem Value="2" Text="Track Variants"/>
                </asp:DropDownList>

I tried putting setup in the onclick, but it fires before the boxes load so its kind of worthless :(.

  • 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-28T19:28:21+00:00Added an answer on May 28, 2026 at 7:28 pm

    UpdatePanels replace the HTML when updated. So the new HTML needs to be rebound. Here is a javascript block to get you going:

        function pageLoaded(sender, args) {
            // There are two arrays (created and updated). Treat them separately if if makes sense
            var updatePanels = args.get_panelsUpdated().concat(args.get_panelsCreated());
            for (var i = 0; i < updatePanels.length; i++) {
                if (updatePanels[i].id == "<%= UpdatePanel1.ClientID %>"){
                    // code to bind contents of UpdatePanel1
                }
            }
        }
        $(document).ready(function () {
            // Handle updatepanel updates
            Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(pageLoaded);
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

ok... so I feel really stupid asking this question.. but just wondering about the
I feel really stupid for asking a question like this, but I cannot seem
I feel really stupid for asking this but I have been thrashing for over
I feel really silly asking this question but how do you add any data
First let me say that I really feel directionless on this question. I am
I feel really silly for asking this, but what am I doing wrong with
I feel really silly for asking this , but how do I place buttons
I feel really stupid asking for this, but remarkably I'm banging my head for
Alright, I feel dumb asking this but I am having issues with a stylized
I feel really dumb for not being able to figure this out so here

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.