AjaxManager: Always update a control

4 posts, 0 answers
  1. Geert
    Geert avatar
    33 posts
    Member since:
    Jul 2008

    Posted 06 Nov 2008 Link to this post


    Masterpage with content pages, In the masterpage there is a control we made called an errorcontrol which displays errors if the content generated them.
    The content is placed dynamically so we now have to set all ajaxsettings in codebehind and for updating the errorcontrol we push the control through to all subcontrols (sometimes 5 deep)

    Is it possible to implement that no matter what control fires an ajaxrequest, the errorcontrol will always be updated on the page??

    Hope this is clear enough.

    Thanks in advance,

    The SOFIM-team (Belgium)
  2. Maria Ilieva
    Maria Ilieva avatar
    4017 posts

    Posted 07 Nov 2008 Link to this post

    Hi Geert,

    In order to achieve the required functionality, you could use ajaxRequest or ajaxRequestWithTarget functions of the RadAjax controls. For more information on this functions, please review the following help topic.

    Maria Ilieva
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Kevin Babcock
    Kevin Babcock avatar
    189 posts
    Member since:
    Mar 2007

    Posted 07 Nov 2008 Link to this post

    Hi Geert,

    You should use a RadAjaxManager on your master page and then RadAjaxManagerProxy controls on your content pages. When creating the AjaxSettings dynamically in your content page code-behind, simply get a reference to the RadAjaxManager on the master page and add an AjaxSetting which causes each control to update the error control on your Master Page.

    Here is a quick example:

    <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Master.master.cs" Inherits="Telerik.Examples.Master" %> 
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    <html xmlns="http://www.w3.org/1999/xhtml" > 
    <head runat="server"
        <title>Example - Always Updating a Control with the RadAjaxManager</title> 
        <form id="form1" runat="server"
            <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />       
            <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" />       
            <asp:Label ID="lblTimeMaster" runat="server" />      
            <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server" /> 

    using System; 
    namespace Telerik.Examples 
        public partial class Master : System.Web.UI.MasterPage 
            protected void Page_Load(object sender, EventArgs e) 
                lblTimeMaster.Text = DateTime.Now.ToString(); 

    <%@ Page Title="" Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Telerik.Examples.Default" %> 
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"
        <telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server"
                <telerik:AjaxSetting AjaxControlID="Button1"
                        <telerik:AjaxUpdatedControl ControlID="lblTime" /> 
        <asp:Label ID="lblTime" runat="server" /> 
        <asp:Button ID="Button1" runat="server" Text="Click Me!" /> 

    using System; 
    using System.Web.UI; 
    using Telerik.Web.UI; 
    namespace Telerik.Examples 
        public partial class Default : System.Web.UI.Page 
            protected void Page_Load(object sender, EventArgs e) 
                var ajaxManager = Page.Master.FindControl("RadAjaxManager1"as RadAjaxManager; 
                if (ajaxManager != null
                    var setting = new AjaxSetting("Button1"); 
                    var updatedControl = new AjaxUpdatedControl { ControlID = "lblTimeMaster" }; 
                lblTime.Text = DateTime.Now.ToLongTimeString(); 

    I hope this helps. If you have further questions, please let me know.

    Kevin Babcock
  4. appdev
    appdev avatar
    223 posts
    Member since:
    Sep 2008

    Posted 20 Apr 2012 Link to this post

Back to Top