locked
Busy cursor or Processing status when Page isn't Posted or Reloaded? RRS feed

  • Question

  • User194338913 posted

    Hello,

    I have a Web Forms page that creates a CSV file after user has pressed button. It would be nice to give user a busy cursor or status text that tells processing is on.

    The problem is that I don't Post or reload that page so how to implement "End of processing" event from Code Behind to User Interface? Otherwise User Interface's Busy cursor is on or status text "Processing..." after CSV file is done.

    Ideas or samples how to implement this?

    Best regards,

    Michael

    Wednesday, September 4, 2019 1:04 PM

All replies

  • User61956409 posted

    Hi Michael,

    how to implement "End of processing" event from Code Behind to User Interface?

    After you generated CSV file, you can call JavaScript function from code behind to let user know the processing is finished, like below.

    protected void btn_createcsv_Click(object sender, EventArgs e)
    {
        //your code logic of generating CSV file
    
        ClientScript.RegisterStartupScript(this.GetType(), "UpdateUI", "myfunc()", true);
    }

    On JavaScript client side

    function myfunc() {
        //your code logic here
        //update UI
        alert("End of processing");
    }

    Test Result

    With Regards,

    Fei Han

    Thursday, September 5, 2019 3:09 AM
  • User-101155366 posted

    Hello,

    Thanks for your answer. Unfortunately I have to call  ClientScript.RegisterStartupScript(this.GetType(), "UpdateUI", "myfunc()", true); from User Control (.ascx.cs) and javascript function is placed to User Control too (.ascx) but calling fails.

    No error messages. Somehow User Control seems to be different that e.g. Web Forms Page because in Page this works.

    So, how to get this work in User Control too?

    Thanks,

    Michael

    Thursday, September 5, 2019 11:06 AM