<%@ Import namespace="System.ComponentModel" %>
<html>
<head>
<title>Dynamically Setting the ImageSet Property of a TreeView Control</title>
<link rel="stylesheet" href="/shared/netdemos.css">
<script language="C#" runat="server">
void Page_Load ( Object src, EventArgs e ) {
if ( !IsPostBack ) {
ICollection borders = TypeDescriptor.GetConverter ( typeof ( TreeViewImageSet ) ).GetStandardValues ( );
foreach ( TreeViewImageSet b in borders ) {
ImageSetSelect.Items.Add ( b.ToString ( ) );
}
}
myTreeView.ImageSet = ( TreeViewImageSet ) ImageSetSelect.SelectedIndex;
}
</script>
</head>
<body>
<!-- #include virtual="~/shared/top.inc" -->
<div class="header"><h2>Dynamically Setting the <span class="hilite">ImageSet</span> Property of a <span class="hilite">TreeView Control</span></h2></div>
<!-- #include virtual="~/shared/viewsrc_top.inc" -->
<hr size=1 width=92%>
<form runat="server">
<p align="center">Select an <b>ImageSet</b>:
<asp:dropdownlist id="ImageSetSelect" runat="server" autopostback /></p>
<div style="margin-left:50">
<asp:treeview id="myTreeView" runat="server"
datasourceid="siteMap"
showlines
expanddepth=2 />
</div>
<asp:sitemapdatasource id="siteMap" runat="server" />
</form>
<hr size=1 width=92%>
<!-- #include virtual="~/shared/viewsrc.inc" -->
</body>
</html>