This is a migrated thread and some comments may be shown as answers.

TreeView OnNodeClick Initial click reloads the page

1 Answer 15 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Eric Klein
Top achievements
Rank 1
Eric Klein asked on 10 Mar 2014, 04:41 PM
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.


1 Answer, 1 is accepted

Sort by
0
Eric Klein
Top achievements
Rank 1
answered on 10 Mar 2014, 04:54 PM
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.
Tags
TreeView
Asked by
Eric Klein
Top achievements
Rank 1
Answers by
Eric Klein
Top achievements
Rank 1
Share this question
or