How to: display page, post back, display again

Discussion in 'ASP .Net' started by =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?=, Jul 14, 2006.

  1. Hi;

    I would like to display a page then immediately cause a post back (the 1st
    page will have a big "working..." on it, then in the post back do my query
    which will take a couple of seconds, and then redisplay the page again.

    What do I do in the first post back so the page is displayed to the user,
    but I then get a post back again?

    --
    thanks - dave
    david_at_windward_dot_net
    http://www.windwardreports.com
    =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?=, Jul 14, 2006
    #1
    1. Advertising

  2. Hi Dave,

    Thank you for your post.

    Based on my understanding, your question is how to cause another postback
    upon page's first load. If I've misunderstood anything, please feel free to
    post here.

    You can do this by registering a startup script to cause the form to submit
    again.

    For example, use following WebForm:

    <form id="form1" runat="server">
    <div>
    <asp:Label ID="Label1" runat="server" Text="Please
    wait..."></asp:Label>&nbsp;</div>
    </form>

    Handle its Load event:

    protected void Page_Load(object sender, EventArgs e)
    {
    if (!IsPostBack)
    {
    ClientScript.RegisterStartupScript(GetType(), "postback",
    "document.forms[0].submit();", true);
    } else
    {
    // simulate a lengthy operation
    System.Threading.Thread.Sleep(5000);
    // hide the "please wait" prompt
    Label1.Visible = false;
    }
    }

    Also, you may find following article useful:

    #PleaseWaitButton ASP.NET Server Control
    http://www.codeproject.com/aspnet/PleaseWaitButton.asp

    Hope this helps. Please feel free to post here if anything is unclear.

    Sincerely,
    Walter Wang
    Microsoft Online Community Support

    ==================================================
    Get notification to my posts through email? Please refer to
    http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
    ications.

    Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
    where an initial response from the community or a Microsoft Support
    Engineer within 1 business day is acceptable. Please note that each follow
    up response may take approximately 2 business days as the support
    professional working with you may need further investigation to reach the
    most efficient resolution. The offering is not appropriate for situations
    that require urgent, real-time or phone-based interactions or complex
    project analysis and dump analysis issues. Issues of this nature are best
    handled working with a dedicated Microsoft Support Engineer by contacting
    Microsoft Customer Support Services (CSS) at
    http://msdn.microsoft.com/subscriptions/support/default.aspx.
    ==================================================

    This posting is provided "AS IS" with no warranties, and confers no rights.
    Walter Wang [MSFT], Jul 14, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ahmed Hashem
    Replies:
    3
    Views:
    840
    James Radke
    Dec 1, 2003
  2. Joby
    Replies:
    0
    Views:
    1,617
  3. Replies:
    3
    Views:
    302
    Eliyahu Goldin
    May 9, 2007
  4. =?Utf-8?B?Z29yaWxsYQ==?=
    Replies:
    1
    Views:
    754
    Masudur
    May 25, 2007
  5. JT

    post data, then post again..

    JT, Sep 5, 2003, in forum: ASP General
    Replies:
    1
    Views:
    133
    Bite My Bubbles
    Sep 6, 2003
Loading...

Share This Page