简体   繁体   中英

Strange javascript error in ASP.NET TreeView control

I'm using Treeview Control (ASP.NET 2.0) in a web control. The funny thing is, that everything is working fine : expanding, collapse, selecting a node etc. ,but after every click firebug shows an error : TreeView_SelectNode is not defined [Break on this error] HelpFile.aspx (line 1)

The error comes up every time I'm selecting a node. I've been going through System.Web.UI.WebControls assembly and found two places, where TreeView_SelectNode is beeing used.

if ((((this._owner.Page != null) && this._owner.Page.SupportsStyleSheets) && (this.SelectAction == TreeNodeSelectAction.Select)) || (this.SelectAction == TreeNodeSelectAction.SelectExpand))
{
  firstScript = Util.MergeScript(firstScript, "TreeView_SelectNode(" + this._owner.ClientDataObjectID + ", this,'" + this.SelectID + "');");
}

and

if (this._owner.RenderClientScript)
{
  list.Add("onclick");
  list.Add("TreeView_SelectNode(" + this._owner.ClientDataObjectID + ", this,'" + this.SelectID + "');");
}

Anybody has a clue, or ideas what else to do, and where else to look ?

Alas, I was unable to reproduce your error. Here's the code I'm using for a simplistic example tree view that throws no javascript errors in Firefox.

    <asp:TreeView ID="TreeView1" runat="server" EnableClientScript="true">
        <Nodes>         
            <asp:TreeNode Text="Node One">
                <asp:TreeNode Text="Node One A" />
            </asp:TreeNode>
            <asp:TreeNode Text="Node Two" />
        </Nodes>
    </asp:TreeView>   

Can you share the code you're using to help debug this issue further?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM