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

Ajax Settings For Master Page Whose Content Page Has User Control

1 Answer 19 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Daniel asked on 03 Jul 2014, 08:38 AM

I am working on a project with a master page. In the content page I have a user control.
Please see the following schema in the file attachment.

Inside the user control there is a RadGrid. There is also an asp:panel and inside it a
custom footer made from dynamic controls.

We added a RadAjaxManagarProxy with the following settings inside the user control:

Radgrid --> Radgrid
Asp_panel --> Asp_panel
Asp_panel --> RadGrid

The content page contains the user-control.

When I press on a control in the master page, I want the RadGrid be update.

How I do that?

I have tried to set the Ajax manager in the master page programmatically: (VB.NET)
Dim MyGridUControl0 As UserControl = CType(MainContentPlaceHolder.FindControl("UC_Grid_Footer0"), UserControl)
Dim MyUGrid0 As RadGrid = CType(MyGridUControl0.FindControl("RadGrid1"), RadGrid)
Dim MyFooter0 As System.Web.UI.Control = CType(MyGridUControl0.FindControl("Panel_Footer"), System.Web.UI.Control)
RadAjaxManager1.AjaxSettings.AddAjaxSetting(treeView_SideMenu, MyUGrid0)
RadAjaxManager1.AjaxSettings.AddAjaxSetting(treeView_SideMenu, MyGridUControl0 )

None of the above works.



1 Answer, 1 is accepted

Sort by
Top achievements
Rank 1
answered on 07 Jul 2014, 07:09 AM
Hi Daniel,

Please have a look into the sample code snippet which works fine at my end. 

MasterPage ASPX :
<telerik:RadAjaxManager ID="rajaxmanagerAjaxifyUserControl" runat="server">
<telerik:RadButton ID="rbtnUpdateLabel" runat="server" Text="Update" OnClick="rbtnUpdateLabel_Click">

MasterPage VB:
Private lbl As Label
Protected Sub Page_Load(sender As Object, e As EventArgs)
    Dim userControlPage As UserControl = DirectCast(ContentPlaceHolder1.FindControl("UserControlPage1"), UserControl)
    lbl = DirectCast(userControlPage.FindControl("lblTestDemo"), Label)
    rajaxmanagerAjaxifyUserControl.AjaxSettings.AddAjaxSetting(rbtnUpdateLabel, lbl)
End Sub
Protected Sub rbtnUpdateLabel_Click(sender As Object, e As EventArgs)
    lbl.Text = "Updated"
End Sub

ContentPage ASPX:
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <uc1:UserControlPage ID="UserControlPage1" runat="server" />

UserControlPage ASCX:
<asp:Panel ID="pnlDemo" runat="server">
    <asp:Label ID="lblTestDemo" runat="server" Text="Demo">

Asked by
Top achievements
Rank 1
Answers by
Top achievements
Rank 1
Share this question