The best one I found was offered by persky. To use it, backup the treeview.htc file and then open it with notepad or some other text editor. Find the function "nodePlusMinusClick" and replace the entire function with the following code:
function nodePlusMinusClick()
{
if (g_bInteractive == false)
return;
var el = this.parentElement.treenode;
// 2 lines below commented out to disable postback on expand/collapse, extra lines added below for better functionality
// if (doNodePlusMinusClick(el) == true)
// fireQueuedEvents();
var index = getNodeIndex(el);
// if the selected or hovered node was one of the collapsed node's descendants then postback anyway
if (selectedNodeIndex.length > index.length && selectedNodeIndex.substr(0,index.length) == index)
{
if (doNodePlusMinusClick(el) == true)
fireQueuedEvents();
}
// otherwise just do the expand/collapse stuff
else
doNodePlusMinusClick(el);
}
pmccoy
Member
20 Points
4 Posts
Re: Disabling treeview events
Aug 01, 2006 12:46 PM|LINK
This link has several solutions: http://forums.asp.net/thread/469254.aspx
The best one I found was offered by persky. To use it, backup the treeview.htc file and then open it with notepad or some other text editor. Find the function "nodePlusMinusClick" and replace the entire function with the following code:
function nodePlusMinusClick() { if (g_bInteractive == false) return; var el = this.parentElement.treenode; // 2 lines below commented out to disable postback on expand/collapse, extra lines added below for better functionality // if (doNodePlusMinusClick(el) == true) // fireQueuedEvents(); var index = getNodeIndex(el); // if the selected or hovered node was one of the collapsed node's descendants then postback anyway if (selectedNodeIndex.length > index.length && selectedNodeIndex.substr(0,index.length) == index) { if (doNodePlusMinusClick(el) == true) fireQueuedEvents(); } // otherwise just do the expand/collapse stuff else doNodePlusMinusClick(el); }