I have a TreeView control that is inside an UpdatePanel. I am trying to show an Ajax-style "please wait" animated GIF while the TreeView loads (it can be slow depending on how much data). To show the GIF I have a modal overlay DIV to grey out the background and another DIV to hold the GIF.
I have managed to show the modal overlay by attaching some jQuery to the click event on the TreeView like so:
SubMenuFoldersTreeView.Attributes.Add("onclick", "$('.modalOverlay').show(); $('.pleaseWait').show();");
This causes the modal overlay to appear when a user expands a tree node - ok so far.
The problem I have is I cannot make the modal overlay disappear after the TreeView has finished populating a node. I tried attaching some javascript like so to the TreeNodePopulate event:
protected void SubMenuFoldersTreeView_TreeNodePopulate(object sender, TreeNodeEventArgs e)
{
PopulateSubMenuSubLevelFolders(Convert.ToInt64(e.Node.Value), e.Node);
ScriptManager.RegisterClientScriptBlock(this, GetType(), "start", "alert('hello');", true);
}
However this does not seem to get added into the page.