<%@ Page Language="C#" Title="Fibonacci Tree On Demand" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void PopulateNode(Object source, TreeNodeEventArgs e)
{
double nodeText = double.Parse(e.Node.Text);
double nodeValue = double.Parse(e.Node.Value);
TreeNode newNode = new TreeNode(nodeValue.ToString(), (nodeText + nodeValue).ToString());
newNode.PopulateOnDemand = true;
e.Node.ChildNodes.Add(newNode);
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server" />
<body>
<form id="form1" runat="server">
<div>
<h3>Fibonacci Tree</h3>
<asp:TreeView ID="_fibonacciTree" OnTreeNodePopulate="PopulateNode"
runat="server" ExpandDepth="1">
<Nodes>
<asp:TreeNode Text="1" Value="1">
<asp:TreeNode PopulateOnDemand="true" Text="1" Value="2" />
</asp:TreeNode>
</Nodes>
</asp:TreeView>
</div>
</form>
</body>
</html>
|