Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_professional thread: Treeview


Message #1 by renevazquez@c... on Wed, 05 Jun 2002 19:34:34 -0400
>      Hi, I use a treeview control and it did not respond to the event 
     handler that i declare.
     
     
     
     
     <SCRIPT LANGUAGE="JavaScript">
        function wasClicked() {
                alert("I was clicked ");
        }
        </SCRIPT>
       
       
     
     
     <iewc:treeview id=trvPart runat="server" 
     TreeNodeXsltSrc="http://localhost/RMAapp/RMAapp_WebUI/XML/PartTree.xsl
     TreeNodeSrc="http://localhost/RMAapp/RMAapp_WebUI/XML/Parts.xml" 
     CssClass="texto" onselectedindexchanged="wasClicked()"> 
     </iewc:TreeView>
     
     
     If anyone know how this happens please let me know
     
     Thanks a lot in advance.

-------------
You have to programmatically attach to the onselectedindexchange (not 
onselectedindexchanged) by javascript on the client.
Something like this:

<script language=javascript>
function treeAttach()
{
  var treeView = document.getElementById("trvPart");
  treeView.onselectedindexchange = wasClicked;
}
</script>
<body onload="treeAttach()">

NB: Note that this only works in IE5.5 and up, since all other browsers 
render a html32 content for the treeview

  Return to Index