So in my documentation it says:
"C# public event TreeViewPlusNodeCheckedEventHandler NodeChecked()
You can use this event to run cause a method to run whenever the check-box for a node is checked on the tree."
So how do I add a method to my code behind file that will run when a node is checked? The method I want to run is:
protected void TOCNodeCheckedServer(object sender, TreeViewPlusNodeEventArgs args)
{
TreeViewPlusNode aNode = args.Node;
if (!aNode.Checked)
return;
List<string> BaseLayers = new List<string>();
_arcTOCConfig.BaseDataLayers.CopyTo(BaseLayers);
List<MapResourceItem> mapResources = new List<MapResourceItem>();
if (BaseLayers.Contains(aNode.Text))
{
foreach (BaseDataLayerElement anEl in _arcTOCConfig.BaseDataLayers)
{
if (!aNode.Text.Equals(anEl.Name))
{
if (aNode.TreeViewPlus.Nodes.FindByValue(anEl.Name).Checked)
{
aNode.TreeViewPlus.Nodes.FindByValue(anEl.Name).Checked = false;
aNode.TreeViewPlus.Nodes.FindByValue(anEl.Name).Refresh();
MapResourceItem aMapResource = this.Map1.MapResourceManagerInstance.ResourceItems.Find(anEl.Name);
aMapResource.DisplaySettings.Visible = false;
this.Map1.RefreshResource(anEl.Name);
mapResources.Add(aMapResource);
this.Map1.MapResourceManagerInstance.ResourceItems.Remove(aMapResource);
}
else
{
MapResourceItem aMapResource = this.Map1.MapResourceManagerInstance.ResourceItems.Find(anEl.Name);
mapResources.Add(aMapResource);
this.Map1.MapResourceManagerInstance.ResourceItems.Remove(aMapResource);
}
}
}
foreach (MapResourceItem aMapResource in mapResources)
{
int count = this.Map1.MapResourceManagerInstance.ResourceItems.Count - 1;
this.Map1.MapResourceManagerInstance.ResourceItems.Insert(count, aMapResource);
this.Map1.MapResourceManagerInstance.CreateResource(aMapResource);
}
this.Map1.InitializeFunctionalities();
this.Map1.Refresh();
}
}
vs 2008 c# .net 3.5