Ajax Settings For Master Page Whose Content Page Has User Control

2 posts, 0 answers
  1. Daniel
    Daniel avatar
    159 posts
    Member since:
    Feb 2014

    Posted 03 Jul 2014 Link to this post


    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.



  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 07 Jul 2014 in reply to Daniel Link to this post

    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">

Back to Top