We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.

# TreeVIew: Select all parents and parents-parents clientside

#### Replies:

97750 Jan 5,2011 09:40 AM UTC Jan 11,2011 03:45 AM UTC General Discussion 1
 Subscribe to this post Tags: General Discussion
Matthias Max
Asked On January 5, 2011 09:40 AM UTC

Is it possible to do this on clientside for a node that gets checked?

Thank you

Varalakshmi R.S [Syncfusion]
Replied On January 11, 2011 03:45 AM UTC

Hi Matthias,

Thank you for your interest in syncfusion products.

"Selecting all parents and parents-parents through client side can be done by recursively checking the parent nodes. Please refer the below code snippet to achieve this,

`[JavaScript]<BR>function NodeOnCheckChanged( NodeEventData )<BR>{<BR>if( NodeEventData.Checked )<BR>{<BR>// When node is checked, then check all parent nodes.<BR>CheckParentNodes( NodeEventData );<BR>}<BR>else<BR>{<BR>// When node is unchecked, then uncheck all child nodes recursive.<BR>UnCheckChildNodesRecursive( NodeEventData );<BR>} <BR>}<BR>function UnCheckChildNodesRecursive( oNode )<BR>{<BR>var arrChildNodes = oNode.Nodes;<BR>if( null != arrChildNodes )<BR>{<BR>for( var i = 0; i < arrChildNodes.length; i++ )<BR>{<BR>var oChildNode = arrChildNodes[i];<BR>oChildNode.UnCheck();<BR>UnCheckChildNodesRecursive( oChildNode );<BR>}<BR>}<BR>}<BR>function CheckParentNodes( oNode )<BR>{ <BR>var oParNode = oNode.ParentNode;<BR>while( null != oParNode )<BR>{<BR>oParNode.Check();<BR>oParNode = oParNode.ParentNode;<BR>}<BR>}<BR>[ASPX]`

http://help.syncfusion.com/ug_84/User%20Interface/ASP.NET/Tools/Documents/howtoautomaticallycheckparentnodewhenchildnodeischeckedanduncheckingchildnodeswhenparentnodeisunchecked.htm

Kindly let us know your concerns.

Regards,
Varalakshmi.R.S

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.