- Home
- Forum
- ASP.NET Web Forms (Classic)
- TreeView with CheckBoxes
TreeView with CheckBoxes
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
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
SIGN IN To post a reply.
5 Replies
AD
Administrator
Syncfusion Team
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
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
AD
Administrator
Syncfusion Team
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.
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.
SH
shalini
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
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
AD
Administrator
Syncfusion Team
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.
'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.
DA
David A. Gonzales
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
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
SIGN IN To post a reply.
- 5 Replies
- 3 Participants
-
DA David A. Gonzales
- Jan 31, 2007 11:55 PM UTC
- Feb 2, 2007 10:02 PM UTC