From: Dave on
Trying to implement a tree control that I cound on the internet. "I
believe" that I'm doing the right thing but I'm currently getting the
following Error:

Element 'ElephantTreeView' is not a known element. This can occur if
there is a compilation error in the Web site, or the web.config file
is missing.


Can someone please point it out what I might be doing wrong.


Thanks


**************************************
****Control on .Master Page*****
**************************************
<asp:Panel ID="Panel1" runat="server" Height="534px"
ScrollBars="Auto"
Width="300px">
<aptera:ElephantTreeView ID="MyTreeView" runat="server"
DataServicesID="" />
</asp:Panel>


**************************************
********** Web.Config ***********
**************************************
<pages theme="Jacobs" enableEventValidation="false"
viewStateEncryptionMode="Never">
<controls>
<add tagPrefix="aptera" namespace="web"/>
</controls>
</pages>


**************************************
************ .CS file **************
**************************************
using System.Web;
using System.Web.UI.WebControls;


namespace web
{
public class ElephantTreeView : TreeView
{
private string GetNodeKey(TreeNode node)
{
return string.Format("{0}_{1}_{2}", this.ID, node.Depth,
node.Text);
}


protected virtual void SaveNodeState(TreeNode node)
{
// determine the node's unique key string
string key = GetNodeKey(node);


// store the node's expansion state
HttpContext.Current.Session[key] = node.Expanded;
}


protected virtual void RestoreNodeState(TreeNode node)
{
object expanded =
HttpContext.Current.Session[GetNodeKey(node)];
if (expanded != null)
{
node.Expanded = (bool)expanded;
}
foreach (TreeNode childNode in node.ChildNodes)
{
RestoreNodeState(childNode);
}
}


protected override void OnDataBound(System.EventArgs e)
{
foreach (TreeNode node in this.Nodes)
{
RestoreNodeState(node);
}


base.OnDataBound(e);
}


protected override void OnTreeNodeExpanded(TreeNodeEventArgs
e)
{
if (Page.IsPostBack)
{
SaveNodeState(e.Node);
}
base.OnTreeNodeExpanded(e);
}


protected override void OnTreeNodeCollapsed(TreeNodeEventArgs
e)
{
// persist the state of the collapsed node
if (Page.IsPostBack)
{
SaveNodeState(e.Node);
}


// go about our other OnTreeNodeCollapsed business
base.OnTreeNodeExpanded(e);
}


protected override void OnLoad(System.EventArgs e)
{
this.EnableClientScript = false;
base.OnLoad(e);
}
}