Progress Bar indicator while expanding a node in the TreeView of Asp .Net

prem07it50-22307
Posted by prem07it50-22307 under ASP.NET category on | Points: 40 | Views : 3680
//JavaScript function for showing a progress indicator while expanding a node in the TreeView

var prevExpandingNode;
var prevExpandingNodeSrc;
var prevExpandingNodeAlt;

function OnExpandClick(evt)
{
var evt = evt || window.event; // event object
var obj = evt.target || window.event.srcElement; // event target
var newURL = window.location.protocol + "//" + window.location.host + "/" + "images/indication.gif";
if (obj.tagName.toLowerCase() == "img" && obj.alt.toLowerCase().substring(0, 6) == "expand")
{
if (prevExpandingNode != undefined)
{
if (prevExpandingNode.alt == "Loading ...")
{
prevExpandingNode.src = prevExpandingNodeSrc;
prevExpandingNode.alt = prevExpandingNodeAlt;
}
}
prevExpandingNode = obj;
prevExpandingNodeSrc = obj.src;
prevExpandingNodeAlt = obj.alt;
obj.src=newURL;
obj.alt = "Loading ...";
}
}


The above code can be called on the TreeView onclick client side event like as follows

<asp:TreeView ID="ctrlTreeViewEmpNodes" runat="server" ExpandDepth="0" ImageSet="Simple"
Height="150px" OnSelectedNodeChanged="ctrlTreeViewEmpNodes_SelectedNodeChanged"
OnTreeNodeExpanded="ctrlTreeViewEmpNodes_TreeNodeExpanded" onclick="OnExpandClick(event);"
OnTreeNodeCollapsed="ctrlTreeViewEmpNodes_TreeNodeCollapsed">

Comments or Responses

Login to post response