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()生成一个列表< TreeNode>然后将它们添加到TreeView中。显示长时间运行的进程消息
看来是第二个写清除加载图像马上发生。 我不希望加载图像消失,直到LoadDirs()完全结束。
Ummm..you必须使用AJAX这样的事情。 http://stackoverflow.com/questions/7704171/asp-net-display-loading-message-while-update-panel-is-updating –
有没有办法在Page_Load上触发它,而不是按下按钮? – Tsukasa
对于Page_Load,我认为你最好的选择是试试这个:http://stackoverflow.com/questions/911059/asp-net-3-5-display-updateprogress-during-page-load –