This is a migrated thread and some comments may be shown as answers.

Hide Expand/Collpase button in code behind for selected nodes

5 Answers 115 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Kiran
Top achievements
Rank 1
Kiran asked on 10 Aug 2010, 12:36 PM
Hi

how I can Hide Expand/Collpase button in code behind for some selected nodes?

Kiran

5 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 10 Aug 2010, 02:38 PM
Hello Kiran,

I am not sure about any property to customize the appearance of expand/collapse button from code behind. One option to perform the same is calling a client method from code behind and executing client code to hide the button. For this, access the node and pass the node value to the client side function. Inside the client function get reference to corresponding node and toggleElement, then apply the style as 'display:none', which in turn hides the toggle-element.

The following forum post shows how to hide the expand/collapse image from client-side code.
Disabling node collapse at the client

Thanks,
Princy.
0
Kiran
Top achievements
Rank 1
answered on 11 Aug 2010, 02:30 PM
Thanks Princy, (I am searching for someother option too, can you help me on this scenario)

Let me explain the problem, I am using TreeNodeExpandMode.ServerSide so I want to hide expand/collpase button for some child nodes on expanding parent node. I tried OnClientNodeExpanded event but the nodes are not are not added in the child node list as the load is on serverside. so is there any event at client side which I can use after the child nodes are loaded?


Kiran
0
Nikolay Tsenkov
Telerik team
answered on 12 Aug 2010, 01:48 PM
Hello Kiran,

In order to get the child collection after it's populated, you can only handle the ClientLoad event over the TreeView. For example you can store in a cookie a flag identifying that the last postback was caused by expand of a node (raise this flag on ClientNodeExpanding) and if the flag states that it is, then you can perform all the actions planned for the loaded child nodes and of course, finally to set the flag back to "false".

Hope this sample procedure will help you solving your problem!


Regards,
Nikolay Tsenkov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Kiran
Top achievements
Rank 1
answered on 13 Aug 2010, 12:18 PM
Thanks!!..
0
Nikolay Tsenkov
Telerik team
answered on 16 Aug 2010, 08:55 AM
Hi Kiran,

You are welcome!
If you experience any further hard time with our controls, please feel free to contact with us again! We are happy to help!


Regard,
Nikolay Tsenkov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
TreeView
Asked by
Kiran
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Kiran
Top achievements
Rank 1
Nikolay Tsenkov
Telerik team
Share this question
or