TreeNode Expand action (VB.net)
<%@ Page Language=VB Debug=true %>
<%@ Import Namespace="Microsoft.Web.UI.WebControls" %>
<%@ Register TagPrefix="IEControls"
Namespace="Microsoft.Web.UI.WebControls"
Assembly ="Microsoft.Web.UI.WebControls"
%>
<script runat=server>
Sub Node_Expand(ByVal Sender as Object, _
ByVal E as TreeViewClickEventArgs)
lblMessage.Text = "You expanded node " _
& E.Node.ToString() & "."
End Sub
</SCRIPT>
<HTML>
<HEAD>
<TITLE>Writing Code that Fires When a TreeNode Expands</TITLE>
</HEAD>
<BODY LEFTMARGIN="40">
<form runat="server">
<IEControls:treeview
id="tvBasic"
onexpand="Node_Expand"
autopostback="True"
runat="server">
<IEControls:treenode Text="Clothing">
<IEControls:treenode Text="Men's"/>
<IEControls:treenode Text="Women's"/>
<IEControls:treenode Text="Children's">
<IEControls:treenode Text="Socks"/>
<IEControls:treenode Text="Shirts"/>
<IEControls:treenode Text="Pants"/>
</IEControls:treenode>
</IEControls:treenode>
<IEControls:treenode Text="Electronics">
<IEControls:treenode Text="TV/VCR"/>
<IEControls:treenode Text="Audio"/>
<IEControls:treenode Text="Car"/>
<IEControls:treenode Text="Computer"/>
</IEControls:treenode>
</IEControls:treeview>
<BR>
<asp:Label
id="lblMessage"
runat="server"
FOnt-Bold="True"
/>
</form>
</BODY>
</HTML>
Related examples in the same category