Treeview Item focus is lost

2 posts, 0 answers
  1. RK
    RK avatar
    18 posts
    Member since:
    Oct 2011

    Posted 13 Apr 2011 Link to this post

    When the user clicks on a treeview item checkbox, the following method is called. However, the page is refreshed and the treeview focus is lost. How can I stay with the currently selected item? Thx.

     


    protected
    void rTree_NodeCheck(object sender, RadTreeNodeEventArgs e)

     

     

    {

     

      hdnCurrentNode.Value = e.Node.Text;

     

      e.Node.ExpandChildNodes();

     

     

     

      if (0 == e.Node.Level)

     

        {

        e.Node.Nodes[i].Checked = e.Node.Checked;

        }

    }

    I tried this code as well:

     

     

    //RadTreeNode rtn = this.rTree.FindNodeByText(hdnCurrentNode.Value, true);

     

     

     

     

     

     

     

     

    //rtn.Selected = true;

     

     

     

     

     

     

     

     

     

    //rtn.Focus();

     

     

     

     

     

     

     

     

     

    //rtn.Visible = true;

     



    But didn't help either.
  2. Nikolay Tsenkov
    Admin
    Nikolay Tsenkov avatar
    734 posts

    Posted 15 Apr 2011 Link to this post

    Hi rk,

    You can send the text/value of the node as a JavaScript variable (using the RegisterClientScript) and in the handler of ClientLoad event of the RadTreeView to find the node (using tree.findNodeByText/findNodeByValue), get it's text element (node.get_textElement()) and then focus the element ($telerik.$(nodeElement).focus()).


    Regards,
    Nikolay Tsenkov
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top