I'm using an example i found on the forum (the one that scrolls to the selected node using a javascript) but it does not work for me.
My layout is like this:
i have a databound treeview with checkboxes.
Under the treeview is a combobox which loads all the nodes that have the checkstatus checked.
The javascript on my page is:
<script language="javascript" type="text/javascript">
function ScrollToSelectedNode()
{
var treeView = <%=radTreeView1.ClientID %>;
var selectedNode = treeView.SelectedNode;
if (selectedNode != null)
{ document.getElementById(selectedNode.ClientID).scrollIntoView(); }
}
</script>
When the user selects a node from the combobox this event fires:
protected
void cmbAllNodes_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
{
string id = e.Value;
RadTreeNode node = radTreeView1.FindNodeByValue(id);
node.Selected =
true;
}
In the aspx file the combobox looks like this:
<
telerik:RadComboBox ID="cmbAllNodes" runat="server" Skin="Outlook" Width="160px" AutoPostBack="True" onselectedindexchanged="cmbAllNodes_SelectedIndexChanged" onclientselectedindexchanged="ScrollToSelectedNode">
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
</telerik:RadComboBox>
So as you can see, when the selected index is changed the selected node of the treeView is changing but the scroll does not.
I call the client side method ScrollToSelectedNode when the user has selected a node from the combobox but the treeView does not scroll to it.
The help is much appreciated.
Thank you.
EDIT: I found out that var treeView = <%=radTreeView1.ClientID %>; does not return my instance of the RadTreeView but in fact it returns a DIV. What am i doing wrong?