I have a problem with RadAjaxManagerProxy. For me the page gets refreshed fully when there is change event occurred in telerik RadComboBox. I have the following controls in my user control.
1. Telerik RadComboBox
2. three Asp.net panel controls.
This user control page is loaded to CMS authoringcontainer by overriding this method.
CreateAuthoringChildControls(
BaseModeContainer authoringContainer)
Based on the telerik combobox selection i will show / hide my asp panels. I am using RadAjaxManagerProxy as my RadAjaxManager exists in my master page. Below is my RadAjaxManagerProxy code.
<telerik:RadAjaxManagerProxy ID="RadAjaxMgrProxy" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="TypeComboBox">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="ContentPanel1" />
<telerik:AjaxUpdatedControl ControlID="ContentPanel2"/>
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManagerProxy>
I have my enabled the autopostback = "true" for that radcombobox.
For me everything looks fine but still my entire page is getting refreshed. Please do let me know what i have missed here.
Regards,
Elango
16 Answers, 1 is accepted
Could you please elaborate a little bit more on how do you hide/show the asp Panels? Please note that you could not add invisible controls in the RadAjaxManagerProxy settings. Make sure that you add only initially visible controls. Additionally, double-check that the ids of the controls specified in the ajax settings are valid, otherwise you may get standard postbacks instead of ajax requests.
If you could not isolate the problem, please paste your code snippets illustrating the problem in this forum post. Thus we will do our best to trace the possible reason for this issue and address it.
Best regards,
Maria Ilieva
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center

Answering your questions and also below i am attaching my code snippets. All the panel controls are visible intially and on change event of combobox i make the visible property of the panels either true or false. If the already there is a value then this property is set true or false @ page_load. So all the visibility actions are done either at page load event or combobox change server events. Below piece of code is part of ascx page
<telerik:RadComboBox ID = "TypeComboBox" runat="server" MarkFirstMatch= "True" Skin="Vista" AutoPostBack = "true" OnSelectedIndexChanged = "TypeComboBox_SelectedIndexChanged">
<CollapseAnimation Type = "OutQuint" Duration = "200" ></CollapseAnimation>
</telerik:RadComboBox>
<asp:Panel ID = "ContentPanel1" runat = "server">
.... few .net controls and telerik controls
</asp:Panel>
<asp:Panel ID = "ContentPanel2" runat = "server">
.... few .net controls and telerik controls
</asp:Panel>
<telerik:RadAjaxManagerProxy ID="RadAjaxMgrProxy" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="TypeComboBox">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="ContentPanel1" />
<telerik:AjaxUpdatedControl ControlID="ContentPanel2"/>
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManagerProxy>
based on this TypeComboBox_SelectedIndexChanged server event i will enable or disable my panels. When this event fires my entire page refreshes.
This user control added to xml placeholder as shown below
protected override void CreateAuthoringChildControls(BaseModeContainer authoringContainer)
{
Control authctrl = (Control)Page.LoadControl("xyz.ascx");
authoringContainer.Controls.Add(authctrl);
}
I guess this code should good for you to verify the issue. Do let me know if i missed anything so that its not working.
Regards,
Elango

Do you have any updates on this issue? Please do let me know.
Regards,
Elango
I tested your scenario, but was not able to replicate the described issue locally. Please find attached a sample project, which contains the same functionalities and which works as expected.
Test it on your side and let us know if this helps.
Kind regards,
Maria Ilieva
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center

This kind of solution that i already tried it locally in another project and it worked fine. But in my development work the scenario is bit different. As we are binding this user control to CMS xml placeholders we won't using this user control in aspx page instead we add the user control in code behind as shown below
protected override void CreateAuthoringChildControls(BaseModeContainer authoringContainer)
{
Control authctrl = (Control)Page.LoadControl("xyz.ascx");
authoringContainer.Controls.Add(authctrl);
}
I doubt the issue could be either if we add the user control like this or it could be because we adding it to authoringContainer which is part of CMS.
Hope my explanation should be good enough for you to check.
Regards,
Elango
The issue shouldn't be caused by loading the UserControl dynamically. I modified the provided project (please find the attachment) and load the control dynamically into asp PlaceHolder and the application still works as expected. Most probably the reason for the issue is in the authoringContainer which is part of CMS, but this should be further investigated.
Kind regards,
Maria Ilieva
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center

Even i guess CMS could be the issue. Are you going to look into this issue? Please let me know.
regards,
Elango
We will further research on this issue in order to isolate the exact reason for the problem. As soon as we have any results we will update you on this case.
Thank you for your cooperation.
Regards,
Maria Ilieva
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center

do you have any results on this issue? We made a temporary fix by using the below solution :
http://blogs.technet.com/stefan_gossner/archive/2006/06/01/how-to-enable-ajax-with-mcms-and-asp-net-2-0-last-update-januar-1st-2007.aspx
We added below code in our templates
// add this Script to handle the confusing between CMS and AJAX
// This handle the CMS ugly URL so AJAX knows where to post back to.
string script = "\n<script type=\"text/javascript\">\n" +
"function EndRequestHandlerCMSFix(sender, args) { \n" +
" if (typeof (__CMS_CurrentUrl) != \"undefined\")\n" +
" {\n" +
" if(Sys.WebForms.PageRequestManager._instance._form._initialAction.indexOf(\"" +Request.Url.GetLeftPart(UriPartial.Authority) + "\", 0) == -1)\n" +
" Sys.WebForms.PageRequestManager._instance._form._initialAction = __CMS_CurrentUrl;\n" +
" else\n" +
" Sys.WebForms.PageRequestManager._instance._form._initialAction = \"" + Request.Url.GetLeftPart(UriPartial.Authority) + "\"+__CMS_CurrentUrl;\n" +
" }\n" +
"}\n" +
"EndRequestHandlerCMSFix(null, null);\n" +
"Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandlerCMSFix);\n" +
"</script>\n";
Page.ClientScript.RegisterStartupScript(this.GetType(), "AdjustAJAXForCMS", script);
It worked fine but we noticed few strange issues with telerik combobox after adding this code. When there is a selectedindex change event happens in our aspx page it occurs once there is a change event and it also happens when there is a change event in another combo box or when the page is saved using save button. Telerik combobox behaves weird in this scenario if we use the solution provided to use ajax. Please let me know how to solve this issue or let me know if you have any solutions for my query.
Regards,
Elango
Any clues would be very helpfull.
Kaj
I made it work... I have combined Elango and Stefan Gossner's scripts to this:
string script = "\n<script type=\"text/javascript\">\n" + |
"function EndRequestHandlerCMSFix(sender, args) { \n" + |
" if (typeof (__CMS_CurrentUrl) != \"undefined\")\n" + |
" {\n" + |
" __CMS_PostbackForm.action = __CMS_CurrentUrl;\n" + |
" if(Sys.WebForms.PageRequestManager._instance._form._initialAction.indexOf(\"" + Request.Url.GetLeftPart(UriPartial.Authority) + "\", 0) == -1)\n" + |
" Sys.WebForms.PageRequestManager._instance._form._initialAction = __CMS_CurrentUrl;\n" + |
" else\n" + |
" Sys.WebForms.PageRequestManager._instance._form._initialAction = \"" + Request.Url.GetLeftPart(UriPartial.Authority) + "\"+__CMS_CurrentUrl;\n" + |
" }\n" + |
" }\n" + |
"EndRequestHandlerCMSFix(null, null);\n" + |
"Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandlerCMSFix);\n" + |
"</script>\n"; |
Page.ClientScript.RegisterStartupScript(this.GetType(), "AdjustAJAXForCMS", script); |
This seems to make both my RadTreeview control and my RadComboBox'es work perfectly. My gridview doesn't work though... Have to work a little on that one.
Could telerik please look into this problem... It seems that the solution described above is only partial.. It would be realy nice to have a full solution on this one - even though MSCMS 2002 is an old-school platform, it is still widely used in many organisations.
Could you please elaborate on the exact scenario that produces the undesired behavior? If I understand you correctly it is related to the RadDatePicker control, right? It will be helpful if you can also paste some markup or code snippets. You may also consider opening a support ticket and attaching to it a small runnable sample which reproduces the issue.
Kind regards,
Pavel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Hi Pavel
Sorry for the late response... I had a long new year vacation, but now I'm back in business...
First of all, the rad version I'm using is 2008.3.1125.35
I'll try to come with a general description of the problem. I don't think it is specifically related to the calendar controls...
The thing is, that using rad controls in a MS-CMS 2002 environment provides problems with the postbacks because the MS-CMS contains a URL rewriter that points nice url's to websites with ugly GUID's... So it is necessary to provide some kind of extra scripting to ensure that ajax postbacks behave correctly. And I think (Not for sure) this is the key problem.
The previous posts in this thread provided some solutions to this. I have tried these, but all solutions had some limitations and strange behaviors. I tried to combine a few of the solutions but it still wasn't a perfect solution. (E.g. the calendar picker control problem i mentioned in the previous post.) I haven't made a thorough test with all controls, but i could suspect that other problems would have similar problems.
The script i made is this:
using System; | |
using System.Data; | |
using System.Configuration; | |
using System.Collections; | |
using System.Web; | |
using System.Web.Security; | |
using System.Web.UI; | |
using System.Web.UI.WebControls; | |
using System.Web.UI.WebControls.WebParts; | |
using System.Web.UI.HtmlControls; | |
using BM.Web.MCms; | |
using Microsoft.ContentManagement.Web.Caching; | |
using Microsoft.ContentManagement.WebControls; | |
using Telerik.WebControls; | |
public partial class Templates_Forms_Frontpage : System.Web.UI.Page | |
{ | |
protected void Page_Load(object sender, System.EventArgs e) | |
{ | |
if (CmsHttpCachePolicy.Current != null) CmsHttpCachePolicy.Current.AddValidationCallbackAllCmsContent(); | |
string script = "\n<script type=\"text/javascript\">\n" + | |
"function EndRequestHandlerCMSFix(sender, args) { \n" + | |
" if (typeof (__CMS_CurrentUrl) != \"undefined\")\n" + | |
" {\n" + | |
" __CMS_PostbackForm.action = __CMS_CurrentUrl;\n" + | |
" if(Sys.WebForms.PageRequestManager._instance._form._initialAction.indexOf(\"" + Request.Url.GetLeftPart(UriPartial.Authority) + "\", 0) == -1)\n" + | |
" Sys.WebForms.PageRequestManager._instance._form._initialAction = __CMS_CurrentUrl;\n" + | |
" else\n" + | |
" Sys.WebForms.PageRequestManager._instance._form._initialAction = \"" + Request.Url.GetLeftPart(UriPartial.Authority) + "\"+__CMS_CurrentUrl;\n" + | |
" }\n" + | |
" }\n" + | |
"EndRequestHandlerCMSFix(null, null);\n" + | |
"Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandlerCMSFix);\n" + | |
"</script>\n"; | |
Page.ClientScript.RegisterStartupScript(this.GetType(), "AdjustAJAXForCMS", script); | |
} | |
protected void Button1_Click(object sender, EventArgs e) | |
{ | |
Response.Redirect("MTUAPVForm.aspx?show=new"); | |
} | |
protected void RadGrid1_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) | |
{ | |
if (e.CommandName == "Load") | |
{ | |
Response.Redirect("MTUAPVForm.aspx?show=" + e.Item.Cells[13].Text); | |
} | |
} | |
/// <summary> | |
/// Handles saving of the content of the radEditors on the page. | |
/// The saving will replace any html anchor tags with javascript anchor tags. | |
/// </summary> | |
/// <param name="sender"></param> | |
/// <param name="e"></param> | |
protected void RadEditorPlaceHolderControl_SavingContent(object sender, PlaceholderControlSavingEventArgs e) | |
{ | |
RadEditorPlaceHolderControl rad = sender as RadEditorPlaceHolderControl; | |
if (rad != null) | |
{ | |
RadEditorAnchorHandler.SaveContent(ref rad); | |
} | |
} | |
/// <summary> | |
/// Handles loading of the content of the radEditors on the page. | |
/// The loading will replace any javascript anchor tags with html anchor tags. | |
/// </summary> | |
protected void RadEditorPlaceHolderControl_LoadedContent(object sender, PlaceholderControlEventArgs e) | |
{ | |
RadEditorPlaceHolderControl rad = sender as RadEditorPlaceHolderControl; | |
if (rad != null) | |
{ | |
RadEditorAnchorHandler.SaveContent(ref rad); | |
} | |
} | |
} | |
I'm not the King of JavaScript, but i think the problems could be solved with some proper java scripting.
I will start a support ticket with a link to this thread.
Thanks,
Kaj
I am afraid that using Ajax in MS-CMS 2002 is not a supported scenario. The result will be the same if you try to use an asp UpdatePanel instead of RadAjax. You probably know that our RadAjaxManager and RadAjaxPanel controls are based on Microsoft's UpdatePanel. Please excuse us if this causes any inconveniences for you.
Sincerely yours,
Pavel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Hi Pavel,
I was afraid this would be the answer, but I fully understand that you will not do any support on a system that went legacy several years ago.
Anyways. I have done a little further experimentation, so for other people who wishes to integrate into MS CMS 2002, read forward.
The soulution I provided above does actually work. The problems I encountered only appears when i add ajaxed telerik controls to a usercontrol, which then is added to a CMS template. When i add the controls directly to the template, everything works fine.
Regards,
Kaj