in my asp.net treeview if i click one parent node then it should be extended if i click again on that node it should be collapsed in treeview... is any javascript availabe for this? or any code in selected node changed?
1 Answer
There's some information here about enabling the expand/collapse on the client. See the Enabling Client Script section.
Basically you need to set EnableClientScript to true for the control.
TreeView1.EnableClientScript = true;
Or
<asp:treeview id="..." runat="server" EnableClientScript="true" ... />
5 Comments
user274139
is it enough for extend and collapse for same parent by clicking on that...or any javascript?
user274139
when i click on that parent node it could expanded but if i again click on that parent it didnt collapse why?
Naeem Sarfraz
have you looked to see if there is a javascript error occuring? Is there some javascript you've written that could be interfering?
user274139
can u provide any javascript for this?
Naeem Sarfraz
EnableClientScript will add the javascript you need. If that's not working you need to investigate why it's not working. Is your browser reporting an error?