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

RadTreeView client side and server side on click

2 Answers 140 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
john81
Top achievements
Rank 1
john81 asked on 10 Aug 2012, 07:15 PM
Using a RadTreeView is it possible to have both server side and client side actions for a node click?  In my application I'm using a RadTreeView to load content into a separate panel when I click on a tree node.  The tree node click should do a call back to retrieve/load data then I'd like to be able to scroll the pane to a div in the content.  Having OnNodeClick and OnClientNodeClicked defined for a RadTreeView causes the client side to fire but not the server side.

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 13 Aug 2012, 09:39 AM
Hi,

You can have both server side and client side actions for a node click in RadTreeview. But clientside action will fire first. So you can call a javascript function from Server side as follows to achieve your scenario.

C#:
protected void RadTreeView1_NodeClick(object sender, RadTreeNodeEventArgs e)
    {
        // Load data
 
        string script = "<script language='javascript'> var panel = document.getElementById('panel1'); var div = document.getElementById('PanelScroll'); panel.scrollTop = div.offsetTop - panel.offsetTop;  </script>";
        Page.ClientScript.RegisterStartupScript(this.GetType(), "Pass", script);
    }

Thanks,
Shinu.
0
john81
Top achievements
Rank 1
answered on 15 Aug 2012, 02:16 PM
That doesn't really accomplish anything unless I do a post back right?  I don't really want to do a post back just to scroll the pane.
Tags
TreeView
Asked by
john81
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
john81
Top achievements
Rank 1
Share this question
or