The new treeview for 2.0 has impressive functions however it seems to have a problem wiring up client-side handling of events like OnSelectedNodeChanged . It is unnecessary overhead to fire server side postbacks every time a node is selected as the web page might just want to populate another control with the label. The following code worked for the 1.1 IE Control but does not seem to work with 2.0. Hopefully I am missing the obvious as this is a common requirement and will have to go with a 3rd party treeview if so
// Create and wire up the javascript event handlers. (server side)
string clickHandler = "javascript:TVIndexChanged();";
this.TreeView1.Attributes.Add("OnSelectedNodeChanged", clickHandler);
ASP form
<
script type="text/javascript">
// Intercepts the index changed event on the client.
//
function TVIndexChanged()
{
// ChangeText( 'node changed' );
alert(
"node changed");
}
<asp:TreeView ID="TreeView1" runat="server" DataSourceID="XmlDataSource1" Style="position: relative" ImageSet="Faq" ShowLines="True" >
<HoverNodeStyle Font-Underline="True" ForeColor="Purple" />