Update RadAjaxPanel from outside RadTreeView:s OnNodeClick event handler, not causing full page reload

2 posts, 0 answers
  1. Ingemar
    Ingemar avatar
    25 posts
    Member since:
    Apr 2012

    Posted 21 Mar Link to this post

    I want to update a RadAjaxPanel, when I have been clicking a RadMenuItem of a RadTreeView.

    That treeview is not inside the RadAjaxPanel but on the same page as it.

    If I add a OnNodeClick handler to the RadTreeView and add a event handler in code behind, then clicking a RadMenuItem of the treeview will cause a postback and the whole page will reload.

    Instead, I want the RadAjaxPanel to reload so I can bind a grid in it.

    How can I do that? I will not move the treeview inside the ajax panel.

  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3908 posts

    Posted 24 Mar Link to this post

    Hello Ingemar,

    You can do this via a RadAjaxManager: http://docs.telerik.com/devtools/aspnet-ajax/controls/ajaxmanager/overview

    For example

    <telerik:RadAjaxManager runat="server" ID="ram1" DefaultLoadingPanelID="ralp1">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="rtv1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="Panel1" />
                    <telerik:AjaxUpdatedControl ControlID="rtv1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel runat="server" ID="ralp1" Skin="Black"></telerik:RadAjaxLoadingPanel>
        <asp:Panel ID="Panel1" runat="server">
            This Panel control used to be a RadAjaxPanel, replace it with the simple asp:Panel
            <br />
            <br />
            <asp:Label ID="Label1" Text="text" runat="server" />
        </asp:Panel>
        <telerik:RadTreeView runat="server" ID="rtv1" OnNodeClick="rtv1_NodeClick">
            <Nodes>
                <telerik:RadTreeNode Text="node 1">
                    <Nodes>
                        <telerik:RadTreeNode Text="node 1 1"></telerik:RadTreeNode>
                        <telerik:RadTreeNode Text="node 1 2"></telerik:RadTreeNode>
                    </Nodes>
                </telerik:RadTreeNode>
                <telerik:RadTreeNode Text="node 2"></telerik:RadTreeNode>
            </Nodes>
        </telerik:RadTreeView>

    protected void rtv1_NodeClick(object sender, RadTreeNodeEventArgs e)
    {
        System.Threading.Thread.Sleep(2000);//simulate network delay
        Label1.Text=DateTime.Now.ToString();
    }

    Regards,

    Marin Bratanov
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top