master page and content page

4 posts, 0 answers
  1. appdev
    appdev avatar
    223 posts
    Member since:
    Sep 2008

    Posted 19 Apr 2012 Link to this post

    will the code below work? but if it does, then every time i add new content page and want to
    have a post back on a control, i have to add that into master page? can't i just have the
    manager in content page?


    below code is in master.master
    <
    telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="btnDecrease">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="TextBox1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>

    below code is in default.aspx
    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
        <asp:Button ID="btnDecrease" runat="server" Text="Increase" OnClick="btnDecrease_Click" />
        <asp:textbox ID="TextBox1" runat="server" Text="0"></asp:Label>
    </asp:Content>

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 20 Apr 2012 Link to this post

    Hello Duy,

    RadAjaxManager can handle only cases when there controls to ajaxify are beneath in the manager control hierarchy. A better approach is placing the RadAjaxManager in MasterPage and adding proxy controls in content pages.
    aspx:
    <telerik:RadAjaxManagerProxy ID="AjaxManagerProxy1" runat="server">
     <AjaxSettings>
       <telerik:AjaxSetting AjaxControlID="btnDecrease">
        <UpdatedControls>
          <telerik:AjaxUpdatedControl ControlID="TextBox1" />
        </UpdatedControls>
       </telerik:AjaxSetting>
     </AjaxSettings>
    </telerik:RadAjaxManagerProxy>

    Thanks,
    Shinu.
  3. appdev
    appdev avatar
    223 posts
    Member since:
    Sep 2008

    Posted 23 Apr 2012 Link to this post

    but then in page load event, what do put instead of RadAjaxManager1.IsInAsyncPostBack.


    i usually do that but now the radajaxmanager1 is in master page and i can't really use that, what do i use for a asyncpostback in content page?
  4. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 26 Apr 2012 Link to this post

    Hi Duy,

    You could get reference to the main manager on the master page and still proceed with the needed check like this:

    ContentPage:
    RadAjaxManager.GetCurrent(Page).IsInAsyncPostBack

    Hope this helps.

    Greetings,
    Maria Ilieva
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top