I am demoing the FlyTreeView control and like the control itself. My problem comes when I try to change anything (non tree view) else on my page, based on an event in the FlyTreeView. All I am trying to do is increment a label on the page by 1 for every time the PopulateNodes event is called. The label updates the first time the page is loaded (and the first set of nodes is populated), but after that the label is never updated again - EVEN though all levels of the nodes can be populated. Am I missing something?
My code (client side):
In my code behind:
protected void TreeView1_PopulateNodes(object sender, FlyTreeNodeEventArgs e)
{
try
{
NameValueCollection listNodes = null;
IL.LevelType level = IL.LevelType.None;
IL.SearchCriteria critiera = new IL.SearchCriteria();
switch (e.Node.Level)
{
case 0: //root node. Level: Region
listNodes = ConvertNameValue(CachedLists.RegionList);
level = IL.LevelType.Region;
critiera.RegionID = int.Parse(e.Node.Value);
break;
case 1: //district/credited district
level = IL.LevelType.Region;
if (SearchFilters1.CreditedDistrictMode)
{
listNodes = ConvertNameValue(CachedLists.RegionCreditedDistrictList(int.Parse(e.Node.Value)).DistinctList);
critiera.CreditedDistrictID = int.Parse(e.Node.Value);
}
else
{
listNodes = ConvertNameValue(CachedLists.RegionDistrictList(int.Parse(e.Node.Value)).DistinctList);
critiera.DistrictID = int.Parse(e.Node.Value);
}
break;
case 2: //atu manager
level = (SearchFilters1.CreditedDistrictMode) ? IL.LevelType.CreditedDistrict : IL.LevelType.District;
IL.GeoFilters filters = new IL.GeoFilters();
if (SearchFilters1.CreditedDistrictMode)
filters.CreditedDistrictID = int.Parse(e.Node.Value);
else
filters.DistrictID = int.Parse(e.Node.Value);
critiera.ATUManagerAlias = e.Node.Value;
listNodes = ConvertNameValue(CachedLists.ATUManagerList.FilteredList(filters));
break;
case 3: //account manager
level = IL.LevelType.ATUManager;
critiera.AccountManagerAlias = e.Node.Value;
listNodes = ConvertNameValue(CachedLists.AccountManagerList.FilteredList(e.Node.Value, new IL.GeoFilters()));
break;
case 4: //account
level = IL.LevelType.AccountManager;
//critiera.
listNodes = ConvertNameValue(CachedLists.AccountList.FilteredList(string.Empty, e.Node.Value, new IL.GeoFilters()));
break;
}
if (listNodes != null)
{
//set up child nodes to populate
for (int i = 0; i < listNodes.Count; i++)
{
FlyTreeNode childNode = new FlyTreeNode(listNodes.GetValues(i)[0], listNodes.Keys[i]);
childNode.PopulateNodesOnDemand = (level != IL.LevelType.Account);
childNode.NavigateUrl = SearchFilters1.NavigateURL(\"Summary.aspx\", level, listNodes.Keys[i]);
childNode.Expanded = false;
e.Node.ChildNodes.Add(childNode);
}
}
int counter = 0;
if (Session[\"counter\"] != null)
counter = (int)Session[\"counter\"];
counter++;
lblTest.Text = \"We've been called \" + counter + \" times!\";
Session[\"counter\"] = counter;
//BELOW IS WHAT EVENTUALLY SHOULD BE HAPPENING - POPULATING A SERIES OF REPEATERS (REPRESENTING HORIZONTAL ROWS OF DATA) ADJACENT TO NODES IN THE TREEVIEW. FOR NOW, I'LL JUST SETTLE FOR THE LABEL UPDATING. :P
//get current rowList if in ViewState
if (ViewState[\"RowList\"] != null)
_rowList = ViewState[\"RowList\"] as ILC.RowList;
//run manual search of newly expanded level. for now, these rows are appended.
_rowList.AddRowList(ILC.RowList.GetRowList(critiera));
//persist rows back to viewstate
ViewState[\"RowList\"] = _rowList;
rptSockets.DataSource = _rowList.SocketList;
rptSockets.DataBind();
}
catch (Exception ex)
{
ShowError(\"expanding Node\", ex, true);
}
}
One more thing - I am eventually going to be using this in an UpdatePanel, but I've tried several combinations of this without success..
Thanx for your thoughts!