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

Treeview Item focus is lost

1 Answer 93 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
RK
Top achievements
Rank 1
RK asked on 13 Apr 2011, 10:48 PM

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.

1 Answer, 1 is accepted

Sort by
0
Nikolay Tsenkov
Telerik team
answered on 15 Apr 2011, 05:34 PM
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.

Tags
TreeView
Asked by
RK
Top achievements
Rank 1
Answers by
Nikolay Tsenkov
Telerik team
Share this question
or