Tsukasa
Tsukasa

Reputation: 6552

Display loading message for long running process

protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            Response.Write("<div id=\"loading\" style=\"position:absolute; width:100%; text-align:center; top:300px;\"><img src=\"https://site here/images/loading.gif\" border=0></div>");
            Response.Flush();
            LoadDirs();
            Response.Write("<script>document.getElementById('loading').style.display='none';</script>");
        }
    }

LoadDirs() builds a List< TreeNode > and then adds them to the TreeView.

It seems the 2nd Write to clear the loading image happens right away. I don't want the loading image to disappear until LoadDirs() is completely finished.

Upvotes: 0

Views: 415

Answers (1)

binard
binard

Reputation: 1784

I think you should use UpdatePanel and UpdateProgress

An introduction here => http://msdn.microsoft.com/en-us/library/vstudio/bb386421(v=vs.100).aspx

Upvotes: 2

Related Questions