and the code behind...
using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using NineRays.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnSearch_Click(object sender, EventArgs e)
{
resetNodes();
}
//clear all tree nodes (except root) and refill
private void resetNodes()
{
FlyTreeView1.Nodes[0].ChildNodes.Clear();
NewFillOrganisations(FlyTreeView1.Nodes[0]);
}
protected void FlyTreeView1_PopulateNodes(object sender, NineRays.WebControls.FlyTreeNodeEventArgs e)
{
switch (e.Node.Level)
{
case 0:
NewFillOrganisations(e.Node);
break;
case 1:
NewFillLocations(e.Node);
break;
}
}
private void NewFillOrganisations(FlyTreeNode parent)
{
for (int count = 0; count < 5; count++)
{
FlyTreeNode node = new FlyTreeNode();
string nodeText = \"Company number \" + count;
node.Value = count.ToString();
node.Attributes.Add(\"Name\", nodeText);
node.NodeTypeID = \"CompanyViewEdit\";
node.PopulateNodesOnDemand = true;
node.CanBeSelected = true;
parent.ChildNodes.Add(node);
}
}
private void NewFillLocations(FlyTreeNode parent)
{
for (int count = 0; count < 5; count++)
{
FlyTreeNode node = new FlyTreeNode();
string nodeText = \"Location number \" + count;
node.Value = count.ToString();
node.Attributes.Add(\"Name\", nodeText);
node.NodeTypeID = \"LocationViewEdit\";
node.PopulateNodesOnDemand = true;
node.CanBeSelected = true;
parent.ChildNodes.Add(node);
}
}
}