|
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TreeView.aspx.cs" Inherits="Samples.TreeView" %>
<%@ Register Assembly="DaveControls" Namespace="DaveControls.HierarchicalControls" TagPrefix="hc" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Hierarchical Repeater Control - Tree View Sample</title>
<link rel="Stylesheet" type="text/css" href="css/styles.css" />
<script type="text/javascript" language="javascript" src="script/treeViewScript.js"></script>
</head>
<body>
<form id="form1" runat="server">
<div>
<h1>Tree View Sample</h1>
<div class="menuTreeContainer">
<p>Expand and collapse the items below by clicking on the <asp:Image ID="Image1" ImageUrl="~/images/workSamples/expand.gif" AlternateText="Expand" runat="server" /> /
<asp:Image ID="Image2" ImageUrl="~/images/workSamples/collapse.gif" AlternateText="Collapse" runat="server" /> buttons. Click on the links to see a description of the item. The expanded or collapsed state of the item will persist across postbacks.</p>
<div class="menuTree">
<hc:HierarchicalRepeater runat="server" ID="TreeViewHierarchicalRepeater" OnItemCommand="TreeViewHierarchicalRepeater_ItemCommand">
<HeaderTemplate>
<ul class="indent treeViewRoot">
</HeaderTemplate>
<ItemTemplate>
<li>
<asp:PlaceHolder ID="ExpandCollapseButtons" runat="server" Visible='<%# Container.HasChildren %>'>
<div id="<%# String.Format("expandButton_{0}", Container.GlobalIndex) %>" class="treeView_expand" onclick="<%# String.Format("treeViewExpand('expandButton_{0}', 'collapseButton_{0}', 'childItems_{0}', {0})", Container.GlobalIndex) %>" style="<%# ((bool)DataBinder.Eval(Container.DataItem, "Expanded")) ? "display:none" : "display:block" %>"></div>
<div id="<%# String.Format("collapseButton_{0}", Container.GlobalIndex) %>" class="treeView_collapse" onclick="<%# String.Format("treeViewCollapse('expandButton_{0}', 'collapseButton_{0}', 'childItems_{0}', {0})", Container.GlobalIndex) %>" style="<%# ((bool)DataBinder.Eval(Container.DataItem, "Expanded")) ? "display:block" : "display:none" %>"></div>
</asp:PlaceHolder>
<asp:LinkButton ID="LinkButton1" runat="server" CommandName="ClickItem" CommandArgument='<%# Container.Path %>' Text='<%# DataBinder.Eval(Container.DataItem, "Text") %>' />
<asp:PlaceHolder ID="ChildrenPlaceholder" runat="server" />
</li>
</ItemTemplate>
<FooterTemplate>
</ul>
</FooterTemplate>
<ChildrenHeaderTemplate>
<ul id="<%# String.Format("childItems_{0}", Container.GlobalIndex) %>" style="<%# ((bool)DataBinder.Eval(Container.DataItem, "Expanded")) ? "display:block" : "display:none" %>">
</ChildrenHeaderTemplate>
<ChildrenFooterTemplate>
</ul>
</ChildrenFooterTemplate>
</hc:HierarchicalRepeater>
<asp:HiddenField runat="server" ID="ExpandCollapseStatesHiddenField" />
</div>
<div class="description">
<asp:PlaceHolder ID="NoDescriptionPlaceholder" runat="server">
Please click on an item to see the description here
</asp:PlaceHolder>
<asp:PlaceHolder ID="DescriptionPlaceholder" runat="server">
<strong><asp:Literal ID="ItemTextLiteral" runat="server" /></strong>
<p><asp:Literal ID="ItemDescriptionLiteral" runat="server" /></p>
</asp:PlaceHolder>
</div>
</div>
</div>
</form>
</body>
</html>
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.