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.
Syncfusion Feedback

TreeView with CheckBoxes

Thread ID:

Created:

Updated:

Platform:

Replies:

55567 Jan 31,2007 11:55 PM UTC Feb 2,2007 10:02 PM UTC ASP.NET Web Forms (Classic) 5
loading
Tags: Tools
David A. Gonzales
Asked On January 31, 2007 11:55 PM UTC

Hi,
I have a simple TreeView that I would like to use as both a Navigation and File Manager tool. I have nodes with CheckBoxes that I would like to select without generating a PostBack but if I click the node (textual portion of the link) it opens up another page (the NavigateURL).

It seems that if I enable the AutoPostBackOnNodeSelect and click a checkbox I get a postback also. I do not what to do this. I want to only do a AutoPostback when I select the link and not the checkbox. I want to be able to select all the checkboxes at one time, then click a button to work with those selected items (such as delete them, print them, etc).

How can I mimic the AutoPostBack in client side for the select that uses the NavigateURL property and opens up the page? I am building the tree dynamically by the way.

Thanks.
David


Administrator [Syncfusion]
Replied On February 2, 2007 04:09 AM UTC

Hi David,

My sincere apologies for the delay in responding to you.

You have to set AutoPostBackOnNodeCheckChanged as false to avoid postback when the checkbox is clicked. We noticed that node click event is called along with Checkbox click event. This is the cause of the issue. To avoid this we have to cancel the node click event in the clientside such as shown below.

$script language="javascript" type="text/javascript">
function nodeCheckChange(node)
{
//Avoids Node click event when the checkbox is Clicked
_sfTreeView1.OnClick(this, event.cancelBubble=true)
}
$/script>

However we have attached one sample for your references.

TreeViewSample.zip

We will get back to you tommorrow regarding your second query.

Thanks for using Syncfusion products.

Regards,
Gokulkumar.B

Administrator [Syncfusion]
Replied On February 2, 2007 06:31 AM UTC

Hi David,

Attached is the sample which helps you to Check and UnCheck all the 'TreeView Nodes' on the button click event.

http://www.syncfusion.com/Support/user/uploads/TreeView-CheckUnCheckNodes_f46b478c.zip

Please let me know if you have any other concerns.

Regards,
Valli.

shalini
Replied On February 2, 2007 07:22 AM UTC

hi,

i've one query abt TreeView with CheckBoxes.

1)Checking the Parent checks all the child nodes.

is it possible ?

Pls reply to me ASAP.

Thanks,
Shalini

Administrator [Syncfusion]
Replied On February 2, 2007 10:06 AM UTC

Hi Shalini,

'Checking' or 'UnChecking' a ParentNode gets its ChildNodes to be checked or unchecked.

Attached is the sample illustrating the sample.

http://www.syncfusion.com/Support/user/uploads/TreeView-CheckParent_a66a55c8.zip

In the above sample 'AutoPostBackOnNodeCheckChanged' is set to true, which triggers a postback and call the serverside function TreeView1_NodeCheckChanged. In 'TreeView1_NodeCheckChanged' we can check or uncheck the subnodes of the TreeView node whose check status has been modified.

Please let us know if you have any further queries.

Regards,
Valli.

David A. Gonzales
Replied On February 2, 2007 10:02 PM UTC

Hi,
Thanks for the information. I was able to handle it by setting a flag when the checkbox was done (in the client-side). I then check to see if the previous event (onCheckClick) was true and did not handle the postback. If it was a node selection (and not a CheckBox Selection) I then did the __doPostBack(). Works like a charm.

David

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.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;