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

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

1 Answer 62 Views
AjaxPanel
This is a migrated thread and some comments may be shown as answers.
Ingemar
Top achievements
Rank 1
Ingemar asked on 21 Mar 2017, 10:05 AM

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.

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 24 Mar 2017, 09:32 AM

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.
Tags
AjaxPanel
Asked by
Ingemar
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or