NodeExpandd blocking NodeClick

5 posts, 0 answers
  1. Charles
    Charles avatar
    5 posts
    Member since:
    Apr 2011

    Posted 04 Jul 2013 Link to this post

    Hello,

    I have a treeview that initially loaded and populated all nodes. Obivously not good for scaling, so I've moved towards serverSide nodeExpand onDemand. This works nice, but I've noticed my nodeClick isn't firing now.

    There is a plus sign on the node, can I not have nodeExpand be fired only when that + is clicked? And if the text/label is clicked have nodeClick fire?

  2. Charles
    Charles avatar
    5 posts
    Member since:
    Apr 2011

    Posted 04 Jul 2013 Link to this post

    Correction,

    the root nodes act ok. But since I'm using ondemand for the expanding nodes, it appears the nodes added (after expanding) don't behave on the onclick.

    Initially populated nodes: click and expand work
    OnDemand populated nodes: expand only works
  3. UI for WPF is Visual Studio 2017 Ready
  4. Charles
    Charles avatar
    5 posts
    Member since:
    Apr 2011

    Posted 05 Jul 2013 Link to this post

    here is a sandboxed version which behaves with the same issue. Initially loaded nodes fire onclicks, but nodes I add on-demand don't fire onclicks...

     

    namespace RadTreeView
    {
        public partial class _Default : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                if (!Page.IsPostBack)
                {
                    this.BuildTree(TestTreeView.Nodes);
                }
                TestTreeView.NodeExpand +=
                    new Telerik.WebControls.RadTreeView.RadTreeViewEventHandler(TestTreeView_NodeExpand);
                TestTreeView.NodeClick +=
                    new Telerik.WebControls.RadTreeView.RadTreeViewEventHandler(TestTreeView_NodeClick);
            }
      
            protected void TestTreeView_NodeExpand(object sender, RadTreeNodeEventArgs e)
            {
                RadTreeNode node = (RadTreeNode)e.NodeClicked;
      
                BuildTree(node.Nodes);
            }
      
            protected void TestTreeView_NodeClick(object sender, RadTreeNodeEventArgs e)
            {
                RadTreeNode node = (RadTreeNode)e.NodeClicked;
            }
      
            private void BuildTree(RadTreeNodeCollection ParentNode)
            {
                for (int i = 0; i < 10; i++)
                {
                    var node = new RadTreeNode("title" + i, "value");
      
                    node.ExpandMode = ExpandMode.ServerSideCallBack;
                    node.NavigateUrl = string.Empty;
                    node.PostBack = true;
      
                    ParentNode.Add(node);
                }
            }
        }
    }
  5. Charles
    Charles avatar
    5 posts
    Member since:
    Apr 2011

    Posted 05 Jul 2013 Link to this post

    This code works fully as expected as soon as I use the latest assemblies. I was using v2. No code change and this works with v4.

    Charles
  6. Charles
    Charles avatar
    5 posts
    Member since:
    Apr 2011

    Posted 05 Jul 2013 Link to this post

    Well, additionally, it appears that the treeview was using Telerik.Webcontrols. I've switched this to Telerik.Web.UI and did some minor code changes and the treeView works onDemand and asExpected :)

    Hopefully someone else finds this useful .
Back to Top
UI for WPF is Visual Studio 2017 Ready