Like this
protected void Page_Load(object sender, EventArgs e)
{
// clear collapsed child nodes every postback
if (IsPostBack && !IsCallback)
{
FlyTreeNodeCollection collapsedNodes =
FlyTreeView1.FindAll(delegate(FlyTreeNode node)
{
return
node.Expanded == false &&
node.PopulateNodesOnDemand == false;
});
foreach (FlyTreeNode node in collapsedNodes)
{
// clear child nodes
node.ChildNodes.Clear();
// and make them populate on demand again
node.PopulateNodesOnDemand = true;
}
}
}