ASP.NET 2.0 Treeview Checkboxes - Check All - Javascript

An update to this post is available at http://geekswithblogs.net/ranganh/archive/2009/01/21/updated-asp.net-treeview-checkboxes-ndash-check-all-ndash-javascript.aspx with suggestions from the comments below and it works when I last checked in IE 8 Beta2, Firefox 3.0.5 and Safari 3.2.1

ASP.NET 2.0 has introduced many new promising controls and TreeView is one among them. There has always been a requirement for Tree Control in earlier versions and it was quite hard to manage them with either the third party controls or the lighter version - IE Webcontrols.

Thanks to ASP.NET team, the 2.0 version rolled out with a built-in Treeview Control. The TreeView has many built-in features such as showing a checkbox for all the Tree Nodes. Node level formating, style, etc., Enabling the ShowCheckBoxes="All" property sets it to show a checkbox for all the nodes. The other options are Leaf, None, Parent and Root which show checkboxes at the respective node levels. None doesnt display CheckBoxes.

When we set ShowCheckBoxes="All", we would like to provide a feature where people can select the checkbox on the Root Node so that all the other checkboxes are checked automatically. Basically, when the parent node is checked, all the child nodes should be checked automatically.

It would be intuitive to accomplish this task at the client side without involving a postback.

The following code snippet helps in accomplishing the same.

TreeView Declaration

<asp:TreeView ID="TreeView1" Runat="server" DataSourceID="XmlDataSource1" onclick="client_OnTreeNodeChecked();" ShowCheckBoxes="all">

<DataBindings>

<asp:TreeNodeBinding DataMember="Category" ValueField="ID" TextField="Name"></asp:TreeNodeBinding>

<asp:TreeNodeBinding DataMember="Description" ValueField="Value" TextField="Value"></asp:TreeNodeBinding>

</DataBindings>

</asp:TreeView>


In the above TreeView declaration Code, you can find the property onclick="client_OnTreeNodeChecked();" event which actually is the JavaScript function which would accomplish this task.

The Javascript Code snippet is as follows:-

<script language="javascript" type="text/javascript">
function client_OnTreeNodeChecked()
{
var obj = window.event.srcElement;
var treeNodeFound = false;
var checkedState;
if (obj.tagName == "INPUT" && obj.type == "checkbox") {
var treeNode = obj;
checkedState = treeNode.checked;
do
{
obj = obj.parentElement;
} while (obj.tagName != "TABLE")
var parentTreeLevel = obj.rows[0].cells.length;
var parentTreeNode = obj.rows[0].cells[0];
var tables = obj.parentElement.getElementsByTagName("TABLE");
var numTables = tables.length
if (numTables >= 1)
{
for (i=0; i < numTables; i++)
{
if (tables[i] == obj)
{
treeNodeFound = true;
i++;
if (i == numTables)
{
return;
}
}
if (treeNodeFound == true)
{
var childTreeLevel = tables[i].rows[0].cells.length;
if (childTreeLevel > parentTreeLevel)
{
var cell = tables[i].rows[0].cells[childTreeLevel - 1];
var inputs = cell.getElementsByTagName("INPUT");
inputs[0].checked = checkedState;
}
else
{
return;
}
}
}
}
}
}
</script>

You may find that in Visual Studio 2005 the onclick method declared in the TreeView is underlined as an error, but still it would work.

This is a simple but sometimes frustrating requirement and hope this benefits similar requirements.

Thanks to
mtntime77 for posting the original idea.

A relevant article on XML Data binding with Treeview with checked state

Cheers and Happy TreeViewing.

posted @ Saturday, March 25, 2006 7:59 AM

Print

Comments on this entry:

# re: ASP.NET 2.0 Treeview Checkboxes - Check All - Javascript

Left by Rich at 3/29/2006 12:43 AM
Gravatar
Great code! Exactly what I'm looking for :-)

Can you post the opposite code (ie: uncheck a child node unchecks all parents but checking a child node does NOT check all parents)?

Thanks!

# re: ASP.NET 2.0 Treeview Checkboxes - Check All - Javascript

Left by Kiks at 3/31/2006 12:15 PM
Gravatar
Hello...
I've worked a little bit more on the above solution with other forum members help...

check it out at...
http://forums.asp.net/1243475/ShowThread.aspx#1243475

I need the complete checkboxes behavoir too...please post if anybody has any ideas or solutions....Thanks!

# re: ASP.NET 2.0 Treeview Checkboxes - Check All - Javascript

Left by Kiks at 3/31/2006 8:28 PM
Gravatar
check out the same thread, above...I've posted a followup/final solution...

# re: ASP.NET 2.0 Treeview Checkboxes - Check All - Javascript

Left by Jake at 4/12/2006 4:27 PM
Gravatar
function goDeeperChecked(obj)
{
var chk1 = true;
//Get the mom.
var head1 = obj.parentElement.previousSibling;
//no rows, cant do my work.
if(obj.rows == null)
{return ;}

//This is how may rows are at this level.
var pTreeLevel1 = obj.rows[0].cells.length;
//Are we a mommy?
if(head1.tagName == "TABLE")
{
//Get the list of rows ahead of us.
var tbls = obj.parentElement.getElementsByTagName("TABLE");
//get the count of that list.
var tblsCount = tbls.length;

//determine if any of the rows underneath are unchecked.
for (i=0; i < tblsCount; i++)
{
var childTreeLevel = tbls[i].rows[0].cells.length;
if (childTreeLevel = pTreeLevel1)
{
var chld = tbls[i].getElementsByTagName("INPUT");
if (chld[0].checked == false)
{
chk1 = false;
break;
}
}
}

var nd = head1.getElementsByTagName("INPUT");
nd[0].checked = chk1;
//do the same for the level above
goDeeperChecked(obj.parentElement);
}
else
{
return;
}
}
function goDeeper(check, obj)
{

//head1 gets the parent node of the unchecked node
var head = obj.parentElement.previousSibling;

if(head.tagName == "TABLE")
{
//checks for the input tag which consists of checkbox
var matchElement = head.getElementsByTagName("INPUT");

//matchElement1[0] gives us the checkbox and it is unchecked
matchElement[0].checked = false;
}
else
{
head = obj.parentElement.previousSibling;
}

if(head.tagName == "TABLE")
{
goDeeper(check, obj.parentElement);
}

else
{
return;
}
}
function treeViewCheck()
{
// obj gives us the node on which check or uncheck operation has performed
var obj = window.event.srcElement;

var treeNodeFound = false;

var checkedState;


//checking whether obj consists of checkbox to avoid exception

if (obj.tagName == "INPUT" && obj.type == "checkbox")
{
var treeNode = obj;
checkedState = treeNode.checked;

//work our way back to the parent <table> element

do
{
obj = obj.parentElement;
}
while (obj.tagName != "TABLE")

var parentTreeLevel = obj.rows[0].cells.length;
var parentTreeNode = obj.rows[0].cells[0];

//get all the TreeNodes inside the TreeView (the parent <div>)
var tables = obj.parentElement.getElementsByTagName("TABLE");

//checking for any node is checked or unchecked during operation
if(obj.tagName == "TABLE")
{
// if any node is unchecked then their parent node are unchecked

if (!treeNode.checked)
{
goDeeper(false, obj);
} //end if - unchecked
//total number of TreeNodes
var numTables = tables.length

if (numTables >= 1)
{
//cycle through all the TreeNodes
//until we find the TreeNode we checked

for (i=0; i < numTables; i++)
{
if (tables[i] == obj)
{
treeNodeFound = true;
i++;
if (i == numTables)
{
//if we're on the last TreeNode, we are done
break;
}
}
if (treeNodeFound == true)
{
var childTreeLevel = tables[i].rows[0].cells.length;
if (childTreeLevel > parentTreeLevel)
{
var cell = tables[i].rows[0].cells[childTreeLevel - 1];
//set the checkbox to match the checkedState

var inputs = cell.getElementsByTagName("INPUT");
inputs[0].checked = checkedState;
}

else
{
//if any of the preceding TreeNodes are not deeper stop
break;
}
} //end if

}//end for
} //end if - numTables >= 1

// if all child nodes are checked then their parent node is checked
if (treeNode.checked)
{
goDeeperChecked(obj);
}//end if - checked

} //end if - tagName = TABLE

} //end if

} //end function

# re: ASP.NET 2.0 Treeview Checkboxes - Check All - Javascript

Left by Gareth at 4/18/2006 7:28 AM
Gravatar
Did anyone else find that this works fine in IE but not in Firefox?

It seems that the OnClick event is firing the client_OnTreeNodeChecked() script.

Anyone got any ideas why \ a work around for this?

# re: ASP.NET 2.0 Treeview Checkboxes - Check All - Javascript

Left by Gareth at 4/18/2006 7:36 AM
Gravatar
Sorry meant to say:
It seems that the OnClick event *isn't* firing the client_OnTreeNodeChecked() script.

# re: ASP.NET 2.0 Treeview Checkboxes - Check All - Javascript

Left by Abhishek at 5/6/2006 11:19 AM
Gravatar
Hii,

function client_OnTreeNodeChecked(event)
{
var TreeNode = event.srcElement || event.target ;

if (TreeNode.tagName == "INPUT" && TreeNode.type == "checkbox")
{
if(TreeNode.checked)
{
alert(TreeNode.title)
}
alert(TreeNode.value)
}
}

I am using the above code to get selected nodes at client side, and it is working fine but the problem is that I want to get Value(TreeNode.Value) of the current node instead of text(TreeNode.title gives TreeNode.Text), TreeNode.value is always returning ‘on’. Please tell me how I can retrieve Value of the node...

Cheerio
Abhishek

# re: ASP.NET 2.0 Treeview Checkboxes - Check All - Javascript

Left by a better version at 5/15/2006 2:37 PM
Gravatar
// JScript File

function goDeeperUnChecked(obj)
{
var chk1 = false;
//Get the mom.
var head1 = obj.parentElement.previousSibling;
//no rows, cant do my work.
if(obj.rows == null)
{return ;}

//This is how may rows are at this level.
var pTreeLevel1 = obj.rows[0].cells.length;

//Are we a mommy?
if(head1.tagName == "TABLE")
{
//Get the list of rows ahead of us.
var tbls = obj.parentElement.getElementsByTagName("TABLE");
//get the count of that list.
var tblsCount = tbls.length;

//determine if any of the rows underneath are unchecked.
for (i=0; i < tblsCount; i++)
{
var childTreeLevel = tbls[i].rows[0].cells.length;
if (childTreeLevel = pTreeLevel1)
{
var chld = tbls[i].getElementsByTagName("INPUT");
if (chld[0].checked == true)
{
chk1 = true;
break;
}
}
}

var nd = head1.getElementsByTagName("INPUT");
nd[0].checked = chk1;
//do the same for the level above
goDeeperUnChecked(obj.parentElement);
}
else
{
return;
}
}


function goDeeper(obj)
{

//head1 gets the parent node of the checked node
var head = obj.parentElement.previousSibling;

if(head.tagName == "TABLE")
{
//checks for the input tag which consists of checkbox
var matchElement = head.getElementsByTagName("INPUT");

//matchElement[0] gives us the checkbox and it is checked
//something is wrong here, fixed
if (matchElement.length>0){
matchElement[0].checked = true;
}

}
else
{

head = obj.parentElement.previousSibling;
}

if(head.tagName == "TABLE")
{
goDeeper(obj.parentElement);
}

else
{
return;
}
}
function treeViewCheck()
{
// obj gives us the node on which check or uncheck operation has performed
var obj = window.event.srcElement;

var treeNodeFound = false;

var checkedState;


//checking whether obj consists of checkbox to avoid exception

if (obj.tagName == "INPUT" && obj.type == "checkbox")
{
var treeNode = obj;
checkedState = treeNode.checked;


//work our way back to the parent <table> element

do
{
obj = obj.parentElement;
}
while (obj.tagName != "TABLE")

var parentTreeLevel = obj.rows[0].cells.length;
var parentTreeNode = obj.rows[0].cells[0];

//get all the TreeNodes inside the TreeView (the parent <div>)
var tables = obj.parentElement.getElementsByTagName("TABLE");

//checking for any node is checked or unchecked during operation
if(obj.tagName == "TABLE")
{

// Modified - if any node is checked then their parent node is checked
if (treeNode.checked)
{
goDeeper(obj);
} //end if - checked

//total number of TreeNodes
var numTables = tables.length

if (numTables >= 1)
{
//cycle through all the TreeNodes
//until we find the TreeNode we checked

for (i=0; i < numTables; i++)
{
if (tables[i] == obj)
{
treeNodeFound = true;
i++;
if (i == numTables)
{
//if we're on the last TreeNode, we are done
break;
}
}
if (treeNodeFound == true)
{

var childTreeLevel = tables[i].rows[0].cells.length;
if (childTreeLevel > parentTreeLevel)
{
var cell = tables[i].rows[0].cells[childTreeLevel - 1];
//set the checkbox to match the checkedState

var inputs = cell.getElementsByTagName("INPUT");
inputs[0].checked = checkedState;

}

else
{
//if any of the preceding TreeNodes are not deeper stop
break;

}
} //end if

}//end for
} //end if - numTables >= 1


//Modified - If all child nodes are unchecked then their parent node is unchecked

if (!treeNode.checked)
{
goDeeperUnChecked(obj);
}//end if - unChecked


} //end if - tagName = TABLE

} //end if

} //end function

# re: ASP.NET 2.0 Treeview Checkboxes - Check All - Javascript

Left by PhiMix at 6/6/2006 2:26 AM
Gravatar
I get an error "event has no properties" when I run "window.event.srcElement;" in Firefox.

It works perfectly in Explorer, but how do I make window.event.srcElement work in Firefox?

Thank you, Mads

# re: ASP.NET 2.0 Treeview Checkboxes - Check All - Javascript

Left by Cynthia at 6/13/2006 12:31 PM
Gravatar
One more thing,

var nd = head1.getElementsByTagName("INPUT");
nd[0].checked = chk1;

should be changed to:

var nd = head1.getElementsByTagName("INPUT");
// Check if there are any elements first
if (nd.length>0){
nd[0].checked = chk1;
}

# re: ASP.NET 2.0 Treeview Checkboxes - Check All - Javascript

Left by Kesav at 6/20/2006 2:39 AM
Gravatar
Great code.
I'm facing a problem that,even if all the parent nodes are deselected, grand parent node is not deselected. Could any ony help me to find a solution for this.

# re: ASP.NET 2.0 Treeview Checkboxes - Check All - Javascript

Left by Trevor at 10/4/2006 8:51 AM
Gravatar
Thanks this came to great use, saved me loads of time..

# re: ASP.NET 2.0 Treeview Checkboxes - Check All - Javascript

Left by Seb at 11/24/2006 12:46 AM
Gravatar
goDeeperUnChecked();
goDeeper();
treeViewCheck();

So great,thx.
But its a pity it doesnt work for grandpa.

# re: ASP.NET 2.0 Treeview Checkboxes - Check All - Javascript

Left by JoeS at 12/23/2006 12:41 PM
Gravatar
I discovered that the html that is emitted by the treeview control can vary when using the predefined treeview formatting settings. I did not test all of the settings, but did discover that the javascript does not work with some settings.

# re: ASP.NET 2.0 Treeview Checkboxes - Check All - Javascript

Left by Brittany at 12/28/2006 5:43 PM
Gravatar
Thank you! Thank you! That code is beautifual. I've had multiple failed attempts at accomplishing javascript that would do just this.

# re: ASP.NET 2.0 Treeview Checkboxes - Check All - Javascript

Left by Brittany at 12/28/2006 5:51 PM
Gravatar
Any idea how to make that javascript work with Firefox?

# re: ASP.NET 2.0 Treeview Checkboxes - Check All - Javascript

Left by Tejas at 1/6/2007 6:26 AM
Gravatar
Hi Great code...

But I want little more functionality...

Now with t his code, when I Unccheck node then it only uncheck the PArent Node...what to do If i wants to uncheck further parent node as no any child node of that parent node is selected...

And also i want to check all the child Nodes on click of Parent node..

Thanks in Advance...

Tejas

# re: ASP.NET 2.0 Treeview Checkboxes - Check All - Javascript

Left by Payal at 1/17/2007 8:57 AM
Gravatar
Please can anyone help me on this
According to the functionality i need,when all checkboxes of child node is unchecked only then checkboxes of the parent node should be unchecked
Please can anybody provide with a relevant script for the same

# re: ASP.NET 2.0 Treeview Checkboxes - Check All - Javascript

Left by Lakshmi Murthy at 2/8/2007 1:49 PM
Gravatar
Hi Harish,

Just a quick question on this:

Does this javascript work on treeview control populated by XMLDataSource only??

I am trying to do the same thing, check and uncheck all on the treeview control populated from database..however, the above script does not seem to WORK!

any ideas?

# re: ASP.NET 2.0 Treeview Checkboxes - Check All - Javascript

Left by vishwanath at 2/15/2007 6:22 AM
Gravatar
Hi,
Harish sir,
Ur code is tremendous,as i am beginner in .net, please send me that category xml file which is used in treeview,and please tell me where i have to place xml file,wiating for ur reply
thank u
Vishwanath

# re: ASP.NET 2.0 Treeview Checkboxes - Check All - Javascript

Left by Vishwanath at 2/15/2007 6:28 AM
Gravatar
Hi,
I am getting below error

The DataSourceID of 'TreeView1' must be the ID of a control of type IHierarchicalDataSource. A control with ID 'XmlDataSource1' could not be found.

# re: ASP.NET 2.0 Treeview Checkboxes - Check All - Javascript

Left by Satish Babu Dasari at 2/22/2007 5:31 AM
Gravatar
Hi
In a tree view i am binding the tree view from the back end when the page is loaded.here when a user check the Prent Node then automatically all the child node will be checked and if the user is unchecked the parent node then all the child nodes will ne unchecked.i am placing the above code in .aspx and i am not rectifying the problem can u pls help.

# re: ASP.NET 2.0 Treeview Checkboxes - Check All - Javascript

Left by Kalimuthu at 3/9/2007 8:36 AM
Gravatar
I am using the above code to get selected nodes at client side, and it is working fine but It is working only IE browser, it isn’t work mozhila firebox Please tell me how I can modify that code

# re: ASP.NET 2.0 Treeview Checkboxes - Check All - Javascript

Left by slavo at 3/13/2007 2:11 PM
Gravatar
...1. error...

if (childTreeLevel = pTreeLevel1)
{
var chld = tbls[i].getElementsByTagName("INPUT");
if (chld[0].checked == false)
{
chk1 = false;
break;
....right....
if (childTreeLevel == pTreeLevel1)
{
var chld = tbls[i].getElementsByTagName("INPUT");
if (chld[0].checked == false)
{
chk1 = false;
break;


...2.error...
var nd = head1.getElementsByTagName("INPUT");
nd[0].checked = chk1;
//do the same for the level above
goDeeperUnChecked(obj.parentElement);
}
else
{
return;
}
}
....right....
var nd = head1.getElementsByTagName("INPUT");
nd[0].checked = chk1;
//do the same for the level above
goDeeperUnChecked(obj.parentElement.previousSibling);
}
else
{
return;
}
}


# re: ASP.NET 2.0 Treeview Checkboxes - Check All - Javascript

Left by Kalimuthu at 3/13/2007 2:24 PM
Gravatar
Anybody help me
I am using the above code to get selected nodes at client side, and it is working fine but It is working only IE browser, it isn’t work mozhila firebox Please tell me how I can modify that code.

# re: ASP.NET 2.0 Treeview Checkboxes - Check All - Javascript

Left by pushp at 5/31/2007 2:43 AM
Gravatar
Hi,

There have been problems with the above script - the check/uncheck behavior is implemented only upto one level up the hierarchy. I've posted the complete solution

check here: http://forums.asp.net/p/976122/1733193.aspx#1733193

# re: ASP.NET 2.0 Treeview Checkboxes - Check All - Javascript

Left by na-rocha at 6/10/2007 6:13 PM
Gravatar
Hi,

is it possible to get the value of the node (TreeNode.Value) on the client side? The TreeNode.Text is possible through "title", but I need the value...please give me some light...

Cheers,
na-rocha

# re: ASP.NET 2.0 Treeview Checkboxes - Check All - Javascript

Left by Sushilkumar Pandey at 6/27/2007 12:52 AM
Gravatar
Great Article

helped me a lot

# re: ASP.NET 2.0 Treeview Checkboxes - Check All - Javascript

Left by Radu at 8/19/2007 9:52 PM
Gravatar
Does anyone know how to make this working with firefox?

# re: ASP.NET 2.0 Treeview Checkboxes - Check All - Javascript

Left by Dustin Horne at 12/19/2007 6:39 AM
Gravatar
Here you go, the asp.net forums has code that works in both IE and Firefox. It also unchecks the parent if you uncheck one of the siblings. I've tested in IE 7 and Firefox 2.0.0.9 and it works well in both:

http://forums.asp.net/p/976122/1733193.aspx#1733193

And here is the code they used:

//************************** Treeview Parent-Child check behaviour ****************************//
function OnTreeClick(evt)
{
var src = window.event != window.undefined ? window.event.srcElement : evt.target;
var isChkBoxClick = (src.tagName.toLowerCase() == "input" && src.type == "checkbox");
if(isChkBoxClick)
{
var parentTable = GetParentByTagName("table", src);
var nxtSibling = parentTable.nextSibling;
if(nxtSibling && nxtSibling.nodeType == 1)//check if nxt sibling is not null & is an element node
{
if(nxtSibling.tagName.toLowerCase() == "div") //if node has children
{
//check or uncheck children at all levels
CheckUncheckChildren(parentTable.nextSibling, src.checked);
}
}
//check or uncheck parents at all levels
CheckUncheckParents(src, src.checked);
}
}
function CheckUncheckChildren(childContainer, check)
{
var childChkBoxes = childContainer.getElementsByTagName("input");
var childChkBoxCount = childChkBoxes.length;
for(var i = 0; i<childChkBoxCount; i++)
{
childChkBoxes[i].checked = check;
}
}
function CheckUncheckParents(srcChild, check)
{
var parentDiv = GetParentByTagName("div", srcChild);
var parentNodeTable = parentDiv.previousSibling;

if(parentNodeTable)
{
var checkUncheckSwitch;

if(check) //checkbox checked
{
var isAllSiblingsChecked = AreAllSiblingsChecked(srcChild);
if(isAllSiblingsChecked)
checkUncheckSwitch = true;
else
return; //do not need to check parent if any(one or more) child not checked
}
else //checkbox unchecked
{
checkUncheckSwitch = false;
}

var inpElemsInParentTable = parentNodeTable.getElementsByTagName("input");
if(inpElemsInParentTable.length > 0)
{
var parentNodeChkBox = inpElemsInParentTable[0];
parentNodeChkBox.checked = checkUncheckSwitch;
//do the same recursively
CheckUncheckParents(parentNodeChkBox, checkUncheckSwitch);
}
}
}
function AreAllSiblingsChecked(chkBox)
{
var parentDiv = GetParentByTagName("div", chkBox);
var childCount = parentDiv.childNodes.length;
for(var i=0; i<childCount; i++)
{
if(parentDiv.childNodes[i].nodeType == 1) //check if the child node is an element node
{
if(parentDiv.childNodes[i].tagName.toLowerCase() == "table")
{
var prevChkBox = parentDiv.childNodes[i].getElementsByTagName("input")[0];
//if any of sibling nodes are not checked, return false
if(!prevChkBox.checked)
{
return false;
}
}
}
}
return true;
}
//utility function to get the container of an element by tagname
function GetParentByTagName(parentTagName, childElementObj)
{
var parent = childElementObj.parentNode;
while(parent.tagName.toLowerCase() != parentTagName.toLowerCase())
{
parent = parent.parentNode;
}
return parent;
}

# re: ASP.NET 2.0 Treeview Checkboxes - Check All - Javascript

Left by Pradeep at 2/7/2008 9:20 PM
Gravatar
The below javascript is the simple to check all the checkboxes in a treeview control

function UnCheckAllCheckBoxes()
{
var ControlToUncheck = document.getElementById('ctl00_maincontent_WTrVwDivisionHierarchy');
var tables = ControlToUncheck.getElementsByTagName("TABLE");
var iLoop;
for(iLoop = 0; iLoop < tables.length; iLoop++)
{
var check = tables[iLoop].getElementsByTagName("INPUT");
var i;
for(i = 0; i < check.length; i++)
{
if(check[i].type = "checkbox")
{
check[i].checked = true;
}
}
}

}

# re: ASP.NET 2.0 Treeview Checkboxes - Check All - Javascript

Left by Saed Omar at 3/17/2008 6:41 PM
Gravatar
Thanks for the owner of first article...

# re: ASP.NET 2.0 Treeview Checkboxes - Check All - Javascript

Left by Mandar at 4/10/2008 9:15 PM
Gravatar
The script works just fine...
great post my friend..!!!

I have another problem, please help me.
1)I want to get the text, value & deapth of the node checked.
2)should alert if its a Root Node.
3)It should be the Leaf node(last node in branch).
and not parent node...!!
4)Should open a page by passing these 3 values ( in modal window )

Can u help me friends ??

Regards,
Mandar

# Expand node when checked

Left by meera at 5/7/2008 8:29 PM
Gravatar
I have a requirement here...
My treeview has checkboxes at every node.Now when I check a node,it should be expanded...all its sub-nodes and sub-nodes of sub-nodes should be expanded
Pls help me..

Thanx in advance

# re: ASP.NET 2.0 Treeview Checkboxes - Check All - Javascript

Left by vivek upadhyay at 7/22/2008 5:33 PM
Gravatar
Thanks a lot

# re: ASP.NET 2.0 Treeview Checkboxes - Check All - Javascript

Left by Mayank at 10/9/2008 5:36 AM
Gravatar
Thank you,
Great piece of code, worked at the first time only

# re: ASP.NET 2.0 Treeview Checkboxes - Check All - Javascript

Left by pradeep at 10/23/2008 11:43 AM
Gravatar
hi
dear sir
thank u for helping .
sir
i want count only checked leaf node
can u help me


i m waiting


pradeep gautam

# re: ASP.NET 2.0 Treeview Checkboxes - Check All - Javascript

Left by Joshep valdivia at 11/22/2008 1:00 AM
Gravatar
greate code my friend Dustin Horne, i just a one question, i dont want to uncheked the parents if i uncheked any child, if i uncheked all childs i want to uncheked the parents, can you help me??
thanks bro, are you greate code master

# re: ASP.NET 2.0 Treeview Checkboxes - Check All - Javascript

Left by Kaz at 1/21/2009 5:33 AM
Gravatar
Hey, man, thanks a lot!
This was really a sheer copy-paste. Saved me time!

# re: ASP.NET 2.0 Treeview Checkboxes - Check All - Javascript

Left by dll at 3/14/2009 8:07 PM
Gravatar
Here when a user check the Prent Node then automatically all the child node will be checked and if the user is unchecked the parent node then all the child nodes will ne unchecked.

# re: ASP.NET 2.0 Treeview Checkboxes - Check All - Javascript

Left by GV at 4/23/2009 12:00 AM
Gravatar
It is a great code

Your comment:



 (will not be displayed)


 
 
 
 

Live Comment Preview:

 
«July»
SunMonTueWedThuFriSat
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678