Check node without OnNodeClick firing?

6 posts, 0 answers
  1. Jason
    Jason avatar
    13 posts
    Member since:
    Sep 2006

    Posted 12 Jan 2011 Link to this post

    Hello,

    I have a TreeView where clicking on a node should trigger a PostBack, but checking a CheckBox on a node should not trigger a PostBack.  Is this possible?  Currently checking the node fires the OnNodeClick event.

    I believe it was working as I wanted prior to upgrading to version 2010.2.826.35.

    <rad:RadTreeView ID="tree" OnNodeClick="NodeClick" AutoPostBack="true">

    Thanks,
    Jason
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 13 Jan 2011 Link to this post

    Hello Jason,


    Set the "AutoPostBackOnCheck"  property of TreeView to "false" to get desired output.

    aspx:
    <radT:RadTreeView ID="RadTreeView1" CheckBoxes="true" AutoPostBack="true" runat="server"  AutoPostBackOnCheck="false"
        MultipleSelect="True" OnNodeClick="RadTreeView1_NodeClick">
    [Assuming that you are using RadControls for ASP.NET version (not Ajax)]



    Thanks,
    Princy.
  3. Jason
    Jason avatar
    13 posts
    Member since:
    Sep 2006

    Posted 13 Jan 2011 Link to this post

    Thanks, but I'm using the ASP.NET AJAX version.
  4. Jason
    Jason avatar
    13 posts
    Member since:
    Sep 2006

    Posted 13 Jan 2011 Link to this post

    I found it.  The "AutoPostBack" is a custom property that sets the PostBack property for each node.
  5. Neha
    Neha avatar
    3 posts
    Member since:
    Feb 2011

    Posted 25 Apr 2011 Link to this post

    The "AutoPostBack" is a custom property that sets the PostBack property for each node. What does that mean? It's not working for me. How to say AutoPostBack="false" for ASP.NET AJAX
  6. Jason
    Jason avatar
    13 posts
    Member since:
    Sep 2006

    Posted 26 Apr 2011 Link to this post

    I have a class that inherits from RadTreeView and I added the AutoPostBack property.  I made that property loop through all of the nodes of the tree and set the PostBack property to whatever value is passed in.

    public class TV : RadTreeView
    {
        private bool autoPostBack = false;
      
        public bool AutoPostBack
        {
            get
            {
                return autoPostBack;
            }
            set
            {
                autoPostBack = value;
      
                foreach (RadTreeNode tn in GetAllNodes())
                {
                    tn.PostBack = autoPostBack;
                }
            }
        }
    }
Back to Top