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.