Element 'ElephantTreeView' is not a known element. This can occur ifthere is a compilation error in

Discussion in 'ASP .Net' started by Dave, Jul 5, 2010.

  1. Dave

    Dave Guest

    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);
    }
    }
     
    Dave, Jul 5, 2010
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Miguel Dias Moura
    Replies:
    4
    Views:
    466
    Hans Kesting
    May 6, 2004
  2. MK
    Replies:
    5
    Views:
    22,638
    deftflux
    Jun 27, 2008
  3. Elmo Watson
    Replies:
    1
    Views:
    379
  4. Replies:
    0
    Views:
    796
  5. John Kotuby
    Replies:
    2
    Views:
    6,703
    shijobaby
    Sep 9, 2010
Loading...

Share This Page