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

  • Home
  • SEARCH
  • 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 4625734
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:18:55+00:00 2026-05-22T03:18:55+00:00

I have some processing that can take up to 5+ seconds the first time

  • 0

I have some processing that can take up to 5+ seconds the first time the page is loaded on the server. This is an external constraint that’s beyond my control and since it’s happening in a WebPart that can be added to any page on servers that are outside of my control, I can’t do this processing at a larger scope such as the application.

I’d like the page to show progress while a partial postback happens in an updatepanel instead of the user waiting for the page to load before seeing anything at all. The code behind that postback will do the busy work.

I’ve tried using an ajax timer which works well except when there’s an exception thrown in the code behind the postback.

In summary I would like to know how to perform a partial postback once and only once as soon as the page loads on the client.

  • 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-22T03:18:55+00:00Added an answer on May 22, 2026 at 3:18 am

    I figured this out. To partial postback to the server via an UpdatePanel without using hidden controls, do this with jQuery:

    <script type="text/javascript">
        $(document).ready(function () {
            __doPostBack('<%=UpdatePanel1.ClientID %>');
        });
    </script>
    

    This will perform a partial postback to the server against the UpdatePanel with the ID UpdatePanel1 as soon as the HTML DOM is ready. You can then use the ASP.NET page life cycle to hook into whatever event is appropriate for you. I hooked into the load event of the update panel:

    protected void UpdatePanel1_Load(object sender, EventArgs e)
    {
        if (Page.IsPostBack && Session["InitializedKey"] == null)
        {
            Session["InitializedKey"] = true;
            // do your initialization stuff here
        }
    }
    

    The code above will only run if the page is posting back and the session variable is set. Now you have to clear the session variable when the user refreshes the page since the intent here is to run this code on the first postback and only the first postback. So clear the session variable in the Page_Load:

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
            Session[initializedKey] = null;
    }
    

    And if you want to show a progress indicator while the page is in partial postback, do this javascript:

    <script type="text/javascript">
        var prm = Sys.WebForms.PageRequestManager.getInstance();
        prm.add_beginRequest(BeginRequestHandler);
        prm.add_endRequest(EndRequestHandler);
        function BeginRequestHandler(sender, args) {
            if (args._postBackElement.id == '<%=UpdatePanel1.ClientID %>') {
                $get('Progress').className = 'Progress';
            }
        }
        function EndRequestHandler(sender, args) {
            if (sender._postBackSettings.sourceElement.id == '<%=UpdatePanel1.ClientID %>') {
                $get('Progress').className = 'Hidden';
            }
        }
    </script>
    

    This requires a div tag with the id ‘Progress’ and whatever you want to show for progress within that div. You also need some css to set the display and visible styles on the div tag in classes named Hidden and Progress. Don’t forget to perform error handling on partial postbacks!

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

Sidebar

Related Questions

We have some files on our website that users of our software can download.
I have a lingo script which runs some data processing for a Flash movie.
I have some UI in VB 2005 that looks great in XP Style, but
We have some input data that sometimes appears with &nbsp characters on the end.
I have some classes layed out like this class A { public virtual void
I have some code like this in a winforms app I was writing to
I have a table that contains lots of integers. This table gets queried and
I have some ASP.NET web services which all share a common helper class they
I have some code for starting a thread on the .NET CF 2.0: ThreadStart
I have some C# / asp.net code I inherited which has a textbox which

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.