RadTreeView client side and server side on click

3 posts, 0 answers
  1. john81
    john81 avatar
    36 posts
    Member since:
    Jan 2010

    Posted 10 Aug 2012 Link to this post

    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. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 13 Aug 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. john81
    john81 avatar
    36 posts
    Member since:
    Jan 2010

    Posted 15 Aug 2012 Link to this post

    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.
Back to Top