
I was wondering if anyone has figured out the following
I have 4 items that have to be able to be refreshed from the Ajax manager control itself.
<
telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="pnlOrganizationMeta" />
<telerik:AjaxUpdatedControl ControlID="pnlOrganizationList" />
<telerik:AjaxUpdatedControl ControlID="pnlProjectList" />
<telerik:AjaxUpdatedControl ControlID="pnlStakeholderList" />
</UpdatedControls>
</telerik:AjaxSetting>
<
telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script type="text/javascript">
function refreshGrid(arg) {
if (arg != null) {
$find(
"<%= RadAjaxManager1.ClientID %>").ajaxRequest(arg);
}
}
</script>
</telerik:RadCodeBlock>
I am using Javascript to get the results of a radwindow close event. currently all of the items show the loading panel even though only one of them is actually being updated. Is there any way I could dynamically choose which one is updated or at least only show the loading panel for that one. With the older versions of the Telerik suite we would have multiple Ajax Managers on the page and control which one was updated depending on the argument passed to the Javascript. With the new version you can only have one AjaxManager on the page.
Thanks
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script type="text/javascript">
function refreshGrid(arg) {
if (arg != 'pnlOrganizationMeta') {
$find(
"<%= RadAjaxManager1.ClientID %>").ajaxRequest(arg);
}
if (arg != 'pnlProjectList') {
$find(
"<%= RadAjaxManager2.ClientID %>").ajaxRequest(arg);
}
}
</script>
</telerik:RadCodeBlock>
12 Answers, 1 is accepted

Try manipulating UpdatedControls collection server-side, like this:
RadAjaxManager m = RadAjaxManager.GetCurrent(this.Page); |
foreach (AjaxSetting aset in m.AjaxSettings) |
{ |
if (aset.AjaxControlID == "RadAjaxManager1") |
{ |
aset.UpdatedControls.Clear(); |
switch (e.Argument) |
{ |
case "pnlOrganizationMeta": |
aset.UpdatedControls.Add(new AjaxUpdatedControl(pnlOrganizationMeta.ClientID, RadAjaxLoadingPanel1.ClientID)); |
break; |
case "pnlProjectList": |
aset.UpdatedControls.Add(new AjaxUpdatedControl(pnlProjectList.ClientID, RadAjaxLoadingPanel1.ClientID)); |
break; |
} |
break; |
} |
} |
"foreach" loop is for the case that your Ajax requests are triggered not only programmatically and therefore you have more than one AjaxSetting section. The loading panel may be the same in all cases (as in the example) or thay can be different.
Regards
Tomasz


protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e) |
{ |
RadAjaxManager m = RadAjaxManager.GetCurrent(this.Page); |
foreach (AjaxSetting aset in m.AjaxSettings) |
{ |
if (aset.AjaxControlID == "RadAjaxManager1") |
{ |
aset.UpdatedControls.Clear(); |
if (e.Argument.Equals("DeleteStakeholder")) |
{ |
ReturnToList(); |
aset.UpdatedControls.Add(new AjaxUpdatedControl(pnlStakeholderMeta.ClientID, RadAjaxLoadingPanel1.ClientID)); |
aset.UpdatedControls.Add(new AjaxUpdatedControl(pnlStakeholderList.ClientID, RadAjaxLoadingPanel1.ClientID)); |
aset.UpdatedControls.Add(new AjaxUpdatedControl(pnlOrganizationList.ClientID, RadAjaxLoadingPanel1.ClientID)); |
aset.UpdatedControls.Add(new AjaxUpdatedControl(pnlStakeholderActivityList.ClientID, RadAjaxLoadingPanel1.ClientID)); |
aset.UpdatedControls.Add(new AjaxUpdatedControl(pnlStakeholderContactList.ClientID, RadAjaxLoadingPanel1.ClientID)); |
aset.UpdatedControls.Add(new AjaxUpdatedControl(pnlPastAffiliations.ClientID, RadAjaxLoadingPanel1.ClientID)); |
} |
else if (e.Argument.ToUpper().Contains("ORGANIZATION")) |
{ |
aset.UpdatedControls.Add(new AjaxUpdatedControl(pnlOrganizationList.ClientID, RadAjaxLoadingPanel1.ClientID)); |
aset.UpdatedControls.Add(new AjaxUpdatedControl(pnlPastAffiliations.ClientID, RadAjaxLoadingPanel1.ClientID)); |
PastAffiliationsList1.BindGrid(); |
OrganizationList1.BindGrid(); |
} |
else if (e.Argument.ToUpper().Contains("ACTIVITY")) |
{ |
aset.UpdatedControls.Add(new AjaxUpdatedControl(pnlStakeholderActivityList.ClientID, RadAjaxLoadingPanel1.ClientID)); |
ActivityStakeholderList1.BindGrid(); |
} |
else if (e.Argument.ToUpper().Contains("STAKEHOLDERCONTACT")) |
{ |
aset.UpdatedControls.Add(new AjaxUpdatedControl(pnlStakeholderContactList.ClientID, RadAjaxLoadingPanel1.ClientID)); |
StakeholderContactListCS1.BindGrid(); |
} |
// Checks ars to see if it a Stakeholder record that is causing the Ajax event to fire |
// if so set the Master record ID to the second value in the array |
else if (e.Argument.Contains(MasterRecordTypeEnum.Stakeholder.ToString())) |
{ |
pnlStakeholderMeta.Visible = true; |
pnlStakeholderList.Visible = false; |
pnlOrganizationList.Visible = true; |
pnlStakeholderActivityList.Visible = true; |
pnlStakeholderContactList.Visible = true; |
aset.UpdatedControls.Add(new AjaxUpdatedControl(pnlStakeholderMeta.ClientID, RadAjaxLoadingPanel1.ClientID)); |
aset.UpdatedControls.Add(new AjaxUpdatedControl(pnlStakeholderList.ClientID, RadAjaxLoadingPanel1.ClientID)); |
aset.UpdatedControls.Add(new AjaxUpdatedControl(pnlOrganizationList.ClientID, RadAjaxLoadingPanel1.ClientID)); |
aset.UpdatedControls.Add(new AjaxUpdatedControl(pnlStakeholderActivityList.ClientID, RadAjaxLoadingPanel1.ClientID)); |
aset.UpdatedControls.Add(new AjaxUpdatedControl(pnlStakeholderContactList.ClientID, RadAjaxLoadingPanel1.ClientID)); |
aset.UpdatedControls.Add(new AjaxUpdatedControl(pnlPastAffiliations.ClientID, RadAjaxLoadingPanel1.ClientID)); |
string[] argArray; |
char[] splitter = { ',' }; |
argArray = e.Argument.Split(splitter); |
this.MasterRecordID = Convert.ToInt32(argArray[1]); |
StakeholderMeta1.setStakeholder((int)this.MasterRecordID); |
OrganizationList1.BindGrid(); |
ActivityStakeholderList1.BindGrid(); |
StakeholderContactListCS1.BindGrid(); |
} |
} |
} |
} |

Hi,
Two important tips:
- the loading panel should be displayed in some place, common for all cases and independent of the control being updated
- the RadAjaxManager's AjaxSetting section mustn't be empty
The loading panel is fired before the request is sent to the server and is based on the current AjaxSetting content. If this content is empty - the panel is by design not displayed. Each time the request is fired the loading panel is displayed according to the previous set of updated controls - that is why it is important that this panel is in a common place; it's a kind of a trick :-)
In your case - an empty AjaxSetting section - the loading panel should be displayed if the request is fired the second time.
Regards
Tomasz

one thing more: you can also try to show and hide the loading panel manually, in OnRequestStart and OnRequestEnd (client side) events (see the documentation; it is well described there).
Regards
Tomasz

<telerik:RadAjaxManager runat="server" ID="RadAjaxManager1" OnAjaxRequest="RadAjaxManager1_AjaxRequest" |
meta:resourcekey="RadAjaxManager1Resource1"> |
<AjaxSettings> |
<telerik:AjaxSetting AjaxControlID="pnlStakeholderList"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="pnlStakeholderList" /> |
<telerik:AjaxUpdatedControl ControlID="pnlStakeholderMeta" /> |
<telerik:AjaxUpdatedControl ControlID="pnlOrganizationList" /> |
<telerik:AjaxUpdatedControl ControlID="pnlStakeholderActivityList" /> |
<telerik:AjaxUpdatedControl ControlID="pnlStakeholderContactList" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
<telerik:AjaxSetting AjaxControlID="pnlStakeholderMeta"> |
<updatedcontrols> |
<telerik:AjaxUpdatedControl ControlID="pnlStakeholderList" /> |
<telerik:AjaxUpdatedControl ControlID="pnlStakeholderMeta" /> |
<telerik:AjaxUpdatedControl ControlID="pnlOrganizationList" /> |
<telerik:AjaxUpdatedControl ControlID="pnlStakeholderActivityList" /> |
<telerik:AjaxUpdatedControl ControlID="pnlStakeholderContactList" /> |
<telerik:AjaxUpdatedControl ControlID="pnlPastAffiliations" /> |
</updatedcontrols> |
</telerik:AjaxSetting> |
<telerik:AjaxSetting AjaxControlID="pnlOrganizationList"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="pnlOrganizationList" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
<telerik:AjaxSetting AjaxControlID="pnlStakeholderActivityList"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="pnlStakeholderActivityList" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
<telerik:AjaxSetting AjaxControlID="pnlStakeholderContactList"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="pnlStakeholderActivityList" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
<telerik:AjaxSetting AjaxControlID="RadAjaxManager1"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="pnlStakeholderList" /> |
<telerik:AjaxUpdatedControl ControlID="pnlStakeholderMeta" /> |
<telerik:AjaxUpdatedControl ControlID="pnlOrganizationList" /> |
<telerik:AjaxUpdatedControl ControlID="pnlStakeholderActivityList" /> |
<telerik:AjaxUpdatedControl ControlID="pnlStakeholderContactList" /> |
<telerik:AjaxUpdatedControl ControlID="pnlPastAffiliations" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
</AjaxSettings> |
</telerik:RadAjaxManager> |
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" |
Skin="Default" meta:resourcekey="RadAjaxLoadingPanel1Resource1"> |
</telerik:RadAjaxLoadingPanel> |
<telerik:RadWindowManager ID="RadWindowManager1" runat="server" AutoSize="True" |
Height="350px" Width="680px" InitialBehavior="Close" |
Modal="True" ShowContentDuringLoad="False" |
ReloadOnShow="True" VisibleStatusbar="False" |
Style="z-index:9999; display: none;" Behavior="Close" InitialBehaviors="Close" |
Behaviors="Move, Close, Resize, Maximize" |
Left="" meta:resourcekey="RadWindowManager1Resource1" Top="" OnClientClose="OnCloseHandler"> |
</telerik:RadWindowManager> |
<script type="text/javascript"> |
//<![CDATA[ |
function openRadWin(Page, QueryString) { |
var windowName = "RadWindow1"; |
if (Page.indexOf("StakeholderContact") > -1) |
windowName = "StakeholderContactList"; |
radopen(Page + '?' + QueryString, windowName); |
var manager = GetRadWindowManager(); |
var window1 = manager.getWindowByName(windowName); |
window1.set_modal(true); |
} |
function OnCloseHandler(sender, args) { |
var window = sender; |
if (window.toString().indexOf("StakeholderContactList") > -1) |
refreshGrid('pnlStakeholderContactList'); |
} |
//]]> |
</script> |
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"> |
<script type="text/javascript"> |
function refreshGrid(arg) { |
if (arg != null) { |
$find("<%= RadAjaxManager1.ClientID %>").ajaxRequest(arg); |
} |
} |
</script> |
</telerik:RadCodeBlock> |
</asp:Content> |
Would it be feasable to put code in the refreshGrid function to change the Ajaxmanager settings?

No, you can't change AjaxSettings client-side. As far as I know :-)
Regards
Tomasz

<%@ Page Title="Stakeholder" Language="C#" MasterPageFile="~/MasterPages/Default.Master" AutoEventWireup="true" |
CodeBehind="Stakeholder.aspx.cs" Inherits="PSR.WebApp.Stakeholder" Culture="auto" |
meta:resourcekey="PageResource2" UICulture="auto" %> |
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> |
<%@ Register Assembly="PeterBlum.DES" Namespace="PeterBlum.DES" TagPrefix="des" %> |
<%@ Register Src="~/UserControls/StakeholderMetaCS.ascx" TagName="StakeholderMeta" TagPrefix="uc1" %> |
<%@ Register Src="~/UserControls/StakeholderListCS.ascx" TagName="StakeholderList" TagPrefix="uc1" %> |
<%@ Register Src="~/UserControls/OrganizationListCS.ascx" TagName="OrganizationList" TagPrefix="uc1" %> |
<%@ Register Src="~/UserControls/ActivityStakeholderListCS.ascx" TagName="ActivityStakeholderList" TagPrefix="uc1" %> |
<%@ Register Src="~/UserControls/PastAffiliationListCS.ascx" TagName="PastAffiliationsList" TagPrefix="uc1" %> |
<%@ Register src="../UserControls/StakeholderContactListCS.ascx" tagname="StakeholderContactListCS" tagprefix="uc2" %> |
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"> |
</asp:Content> |
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> |
<des:PageManager ID="PageManager1" runat="server" AJAXFramework="MicrosoftAJAX" AllInAJAXUpdate="True" |
PreLoadForAJAX-Validators="True" PreLoadForAJAX-SubmitControls="True" PreLoadForAJAX-TextBoxes="True" |
ShortDatePatternOverride="yyyy-MM-dd" |
meta:resourcekey="PageManager1Resource1"> |
</des:PageManager> |
<div class="mainlists"> |
<asp:Panel ID="pnlStakeholderList" runat="server" CssClass="fullcontent" |
RenderMode="Inline" meta:resourcekey="pnlStakeholderListResource1"> |
<h4 class="whitetext"><asp:Label ID="lblStakeholderListTitle" Text="Stakeholders" |
runat="server" meta:resourcekey="lblStakeholderListTitleResource1"/></h4> |
<uc1:StakeholderList ID="StakeholderList1" runat="server" /> |
</asp:Panel> |
<asp:Panel ID="pnlStakeholderMeta" runat="server" CssClass="fullcontent" |
Visible="False" RenderMode="Inline" |
meta:resourcekey="pnlStakeholderMetaResource1"> |
<uc1:StakeholderMeta ID="StakeholderMeta1" runat="server" /> |
</asp:Panel> |
</div> |
<div class="sublists"> |
<asp:Panel ID="pnlOrganizationList" runat="server" CssClass="leftcontent" |
Visible="False" RenderMode="Inline" |
meta:resourcekey="pnlOrganizationListResource1"> |
<div class="pad"> |
<h4 class="whitetext"><asp:Label ID="lblOrganizationListTitle" Text="Organizations" |
runat="server" meta:resourcekey="lblOrganizationListTitleResource1"/></h4> |
<uc1:OrganizationList ID="OrganizationList1" runat="server" /> |
</div> |
</asp:Panel> |
<asp:Panel ID="pnlStakeholderActivityList" runat="server" |
CssClass="rightcontent" Visible="False" RenderMode="Inline" |
meta:resourcekey="pnlStakeholderActivityListResource1"> |
<div class="pad"> |
<h4 class="whitetext"><asp:Label ID="lblActivitiesTitle" Text="Activities" |
runat="server" meta:resourcekey="lblActivitiesTitleResource1"/></h4> |
<uc1:ActivityStakeholderList ID="ActivityStakeholderList1" runat="server" /> |
</div> |
</asp:Panel> |
</div> |
<div class="mainlists margin10-top"> |
<asp:Panel ID="pnlStakeholderContactList" runat="server" CssClass="fullcontent" Visible="False" RenderMode="Inline" meta:resourcekey="pnlStakeholderActivityListResource1"> |
<div class="pad"> |
<h4 class="whitetext"><asp:Label ID="lblParksContactsTitle" |
Text="Parks Canada Contacts" runat="server" |
meta:resourcekey="lblParksContactsTitleResource1"/></h4> |
<uc2:StakeholderContactListCS ID="StakeholderContactListCS1" runat="server" /> |
</div> |
</asp:Panel> |
</div> |
<div class="mainlists margin10-top"> |
<asp:Panel ID="pnlPastAffiliations" runat="server" CssClass="fullcontent" Visible="False" RenderMode="Inline"> |
<div class="pad"> |
<h4 class="whitetext"><asp:Label ID="lblPastAffiliations" Text="Past Affiliations" runat="server"/></h4> |
<uc1:PastAffiliationsList ID="PastAffiliationsList1" runat="server" /> |
</div> |
</asp:Panel> |
</div> |
<telerik:RadAjaxManager runat="server" ID="RadAjaxManager1" OnAjaxRequest="RadAjaxManager1_AjaxRequest" |
meta:resourcekey="RadAjaxManager1Resource1" |
DefaultLoadingPanelID="RadAjaxLoadingPanel1"> |
<AjaxSettings> |
<telerik:AjaxSetting AjaxControlID="pnlStakeholderList"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="pnlStakeholderList" /> |
<telerik:AjaxUpdatedControl ControlID="pnlStakeholderMeta" /> |
<telerik:AjaxUpdatedControl ControlID="pnlOrganizationList" /> |
<telerik:AjaxUpdatedControl ControlID="pnlStakeholderActivityList" /> |
<telerik:AjaxUpdatedControl ControlID="pnlStakeholderContactList" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
<telerik:AjaxSetting AjaxControlID="pnlStakeholderMeta"> |
<updatedcontrols> |
<telerik:AjaxUpdatedControl ControlID="pnlStakeholderList" /> |
<telerik:AjaxUpdatedControl ControlID="pnlStakeholderMeta" /> |
<telerik:AjaxUpdatedControl ControlID="pnlOrganizationList" /> |
<telerik:AjaxUpdatedControl ControlID="pnlStakeholderActivityList" /> |
<telerik:AjaxUpdatedControl ControlID="pnlStakeholderContactList" /> |
<telerik:AjaxUpdatedControl ControlID="pnlPastAffiliations" /> |
</updatedcontrols> |
</telerik:AjaxSetting> |
<telerik:AjaxSetting AjaxControlID="pnlOrganizationList"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="pnlOrganizationList" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
<telerik:AjaxSetting AjaxControlID="pnlStakeholderActivityList"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="pnlStakeholderActivityList" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
<telerik:AjaxSetting AjaxControlID="pnlStakeholderContactList"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="pnlStakeholderActivityList" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
<telerik:AjaxSetting AjaxControlID="RadAjaxManager1"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="pnlStakeholderList" /> |
<telerik:AjaxUpdatedControl ControlID="pnlStakeholderMeta" /> |
<telerik:AjaxUpdatedControl ControlID="pnlOrganizationList" /> |
<telerik:AjaxUpdatedControl ControlID="pnlStakeholderActivityList" /> |
<telerik:AjaxUpdatedControl ControlID="pnlStakeholderContactList" /> |
<telerik:AjaxUpdatedControl ControlID="pnlPastAffiliations" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
</AjaxSettings> |
</telerik:RadAjaxManager> |
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" |
Skin="Default" meta:resourcekey="RadAjaxLoadingPanel1Resource1" > |
</telerik:RadAjaxLoadingPanel> |
<telerik:RadWindowManager ID="RadWindowManager1" runat="server" AutoSize="True" |
Height="350px" Width="680px" InitialBehavior="Close" |
Modal="True" ShowContentDuringLoad="False" |
ReloadOnShow="True" VisibleStatusbar="False" |
Style="z-index:9999; display: none;" Behavior="Close" InitialBehaviors="Close" |
Behaviors="Move, Close, Resize, Maximize" |
Left="" meta:resourcekey="RadWindowManager1Resource1" Top="" OnClientClose="OnCloseHandler"> |
</telerik:RadWindowManager> |
<script type="text/javascript"> |
//<![CDATA[ |
function openRadWin(Page, QueryString) { |
var windowName = "RadWindow1"; |
if (Page.indexOf("StakeholderContact") > -1) |
windowName = "StakeholderContactList"; |
radopen(Page + '?' + QueryString, windowName); |
var manager = GetRadWindowManager(); |
var window1 = manager.getWindowByName(windowName); |
window1.set_modal(true); |
} |
function OnCloseHandler(sender, args) { |
var window = sender; |
if (window.toString().indexOf("StakeholderContactList") > -1) |
refreshGrid('pnlStakeholderContactList'); |
} |
//]]> |
</script> |
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"> |
<script type="text/javascript"> |
function refreshGrid(arg) { |
if (arg != null) { |
var ajaxmanager = $find("<%= RadAjaxManager1.ClientID %>"); |
ajaxmanager.ajaxRequest(arg); |
} |
} |
</script> |
</telerik:RadCodeBlock> |
</asp:Content> |
The Loading panel still shows on all loading panels when called from the RefreshGrid fucntion.

you have two choices:
- one, common loading panel (see here); remember to set IsSticky="true"
- individual panels for each case; IsSticky="false":
- client side: show and hide panel / panels in OnRequestStart / OnRequestEnd (see here); don't set RadAjaxManager.DefaultLoadingPanelID property
- server side: while adding items to UpdatedControls collection, set loadPID argument of the AjaxUpdatedControl class constructor to ""
Regards
Tomasz

i am new in Telerik control .. i want to add radgrid to
AjaxUpdatedControl
such as update panel is used ..... how can i do this ..page is flickering i want to stop this .... please help us or give the reference or example......

I'm sorry, but there are tonns of examples around. Read the documentation, check demos, browse the knowledge base. Your question / request is so general that it's impossible to answer.
Good luck.
Regards
Tomasz
Here are some online resources which will guide you in ajaxifying your page:
http://www.telerik.com/help/aspnet-ajax/ajax-ajaxmanager.html
http://www.telerik.com/help/aspnet-ajax/ajax-ajaxpanel.html
http://demos.telerik.com/aspnet-ajax/ajax/examples/manager/firstlook/defaultcs.aspx
http://demos.telerik.com/aspnet-ajax/ajax/examples/panel/firstlook/defaultcs.aspx
Regards,
Maria Ilieva
the Telerik team