I'd like the CollapsiblePanel to close when a treenode is clicked

  • Thread starter Thread starter Cal Who
  • Start date Start date
C

Cal Who

The code below shows a CollapsiblePanel followed by an iframe.

When the CollapsiblePanel is opened and a treeNode within it is clicked, the
site shows in the iframe.

What I would like is for the CollapsiblePanel to close at that time (in the
real code the tree is very big).

Can you show how to do that?

Thanks

PS Is the way I've coded the iframe OK?





<ajaxToolkit:CollapsiblePanelExtender ID="CollapsiblePanelExtender1"
runat="server" TargetControlID="PnlContent" ExpandControlID="PnlTitle"
CollapseControlID="PnlTitle" TextLabelID="Label1" Collapsed="True"
SuppressPostBack="true">

</ajaxToolkit:CollapsiblePanelExtender>

<asp:Panel ID="PnlTitle" runat="server">

SELECT A SITE BY CLICKING HERE

</asp:Panel>

<asp:Panel ID="PnlContent" runat="server">

<asp:TreeView ID="TreeView2" runat="server">

<Nodes>

<asp:TreeNode Text="SITES" Value="SITES">

<asp:TreeNode NavigateUrl="http://site1" Target="LinksFrame2"
Text="Site1"></asp:TreeNode>

<asp:TreeNode NavigateUrl="http://site2" Target="LinksFrame2"
Text="Site2"></asp:TreeNode>

<asp:TreeNode NavigateUrl="http://site3" Target="LinksFrame2"
Text="Site3"></asp:TreeNode>

</asp:TreeNode>

</Nodes>

</asp:TreeView>

</asp:Panel>



<h4>

THE SITE SELECTED DISPLAYS BELOW</h4>

<%-- Must use name per test and documentation. --%>

<iframe name="LinksFrame2" src="MakeBlack.htm" frameborder="0"
height="700px" width="100%" style="background: inherit;">Your browser does
not support iframes.</iframe>
 
I can add and event to all the anchors with
<script type="text/javascript">

var links = document.getElementsByTagName('a');

for(var i=0;i<links.length;++i)links.onclick=function(){ alert("QQQQ");

return true;

}

</script>

That is it finds all anchors that are not in the PnlContent panel ( I didn't
show those) but the code ignore the ones in the panel.

Is there some recursion search that I can use or some other way to find the
anchors in the panel?

I looked at the source in the browser and the anchors are there the code is
just not finding them

Thanks
 
Back
Top