TreeView OnNodeClick Initial click reloads the page

2 posts, 0 answers
  1. Eric Klein
    Eric Klein avatar
    183 posts
    Member since:
    Aug 2009

    Posted 10 Mar 2014 Link to this post

    I have a screen where I have a treeview that loads 

     foreach (var user in allUsers)
                {
                    var claims = db.AspNetUserClaims.Where(c => c.User_Id == user.Id);
                    foreach (var claim in claims)
                    {
                        if (claim.ClaimType == ClaimTypes.Role)
                        {
                            for (int i = 0; i < UserTree.Nodes.Count; i++)
                                if (claim.ClaimValue == UserTree.Nodes[i].Text)
                                {
                                    var userNode = new RadTreeNode(user.UserName, user.Id);
                                    UserTree.Nodes[i].Nodes.Add(userNode);
                                }
                        }
                    }
                }

    This loads fine when I click  + for the parent it expands to show the children.  This all works the issue is on the NodeClick event.  The very first time I click on a node it reloads the page and never runs the NodeClick Event.  After this one time event everything works properly.  I can expand and contract nodes and when I click on a node it rune the node click properly.  It is just the initial node click after the page loads that has this behavior.


  2. Eric Klein
    Eric Klein avatar
    183 posts
    Member since:
    Aug 2009

    Posted 10 Mar 2014 in reply to Eric Klein Link to this post

    The one thing I have found is the initial post is not being viewed as a postback.  the Page.IsPostBack is false for the initial click after that click it is true.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top