I have just upgraded an app from RadAjax Classic to the latest version for ASP .NET AJAX. I have been through the process of switching to the RadAjaxManagerProxy, adding ajax settings programatically in Page_Load instead of Page_Init etc.
Now most of my ajax updates are now working but some are not.
Error: [Exception... "'Sys.InvalidOperationException: Sys.InvalidOperationException: Could not find UpdatePanel with ID 'someAjaxifiedControlPanel'. If it is being updated dynamically then it must be inside another UpdatePanel.' when calling method: [nsIDOMEventListener::handleEvent]" nsresult: "0x8057001c (NS_ERROR_XPC_JS_THREW_JS_OBJECT)" location: "<unknown>" data: no]
The particular control that this error message is complaining about is not part of the current update and is not currently visible. With RadAjax Classic this didn't matter, so I don't think this is the issue.
What causes this error?
5 Answers, 1 is accepted
It is good that you moved the dynamic ajax settings creation on Page_Load as suggested here. However I have to mention that with the "new" RadAjax, it is preferable to add only always visible controls to the ajax setting pairs. Therefore I suggest that you wrap the someAjaxifiedControl control into a ASP:Panel control and add the outer panel to the ajax settings instead.
Please check it out and let me know if this helps.
the Telerik team
With RadAjax Classic this setup was very easy to manage. If the first panel becomes invisible it should not affect updates in the second panel because the two panels are not involved in the same update.
In a complex scenario isn't it much harder to manage if I have to worry about whether a control is visible or not every time I Ajaxify it?
Wouldn't it be worse for performance to have to wrap large sections of the page in ajaxified panels, in case some of the controls are inivisble?
In fact in the preceding setup, the fact that the fist Panel is invisible, does not directly affect the second Panel. Here the fact that invisible content if ajaxified is the spoiler.
However I can agree your arguments are reasonable, note that RadAjax for ASP.NET AJAX is built on top of MS AJAX Framework which is a different technology from this lying under RadAjax for ASP.NET. That is why there might be slight difference in the both RadAjax controls behavior.
the Telerik team
Problem Fixed !!
This error generally occurs when a hidden controls fall under AJAX. Suppose you have a textbox on the page and it gets hidden and displayed based on some setting and the same textbox is added under ajax setting on the .aspx page with some submit button. Now if the textbox is hidden based on setting and we hit submit button then it will generate "Sys.InvalidOperationException: Could not find UpdatePanel with ID " error.
The best practice in such cases, when the controls are displayed based on some setting is to Ajaxify controls pro-grammatically. Add the controls on the page_load method and also with events of control like radcombobox selectedIndexChange event if some dropdowns are dependent.
radAjaxManager.AjaxSettings.AddAjaxSetting(cmdSubmit, txtAddress, AjaxLoadingPanel1, UpdatePanelRenderMode.Inline)