This is a migrated thread and some comments may be shown as answers.

Sys.InvalidOperationException: Could not find UpdatePanel with ID '...'

5 Answers 623 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Andrew Lawrence
Top achievements
Rank 1
Andrew Lawrence asked on 09 Mar 2009, 03:52 AM
Hi,
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.

After certain updates the page fails to update and I get the following javascript error:

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

Sort by
0
Iana Tsolova
Telerik team
answered on 09 Mar 2009, 02:03 PM
Hello Andrew,

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.

Best wishes,
Iana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Andrew Lawrence
Top achievements
Rank 1
answered on 09 Mar 2009, 10:52 PM
So the following scenario is no longer possible?

<asp:Panel runat="server" ID="pnlFirst" Visible="false">   
    <asp:TextBox runat="server" ID="txtFirst" />   
    <asp:Button runat="server" ID="btnFirst" />   
</asp:Panel>   
   
<asp:Panel runat="server" ID="pnlSecond">   
    <asp:TextBox runat="server" ID="txtSecond" />   
    <asp:Button runat="server" ID="btnSecond" />   
</asp:Panel>   
   
<telerik:RadAjaxManager runat="server" ID="ram">   
    <AjaxSettings>   
        <telerik:AjaxSetting AjaxControlID="btnFirst">   
            <UpdatedControls>   
                <telerik:AjaxUpdatedControl ControlID="txtFirst" />   
            </UpdatedControls>   
        </telerik:AjaxSetting>   
    </AjaxSettings>   
    <AjaxSettings>   
        <telerik:AjaxSetting AjaxControlID="btnSecond">   
            <UpdatedControls>   
                <telerik:AjaxUpdatedControl ControlID="txtSecond" />   
            </UpdatedControls>   
        </telerik:AjaxSetting>   
    </AjaxSettings>   
</telerik:RadAjaxManager>   


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?
0
Iana Tsolova
Telerik team
answered on 11 Mar 2009, 03:25 PM
Hello Andrew,

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. 

Sincerely yours,
Iana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
khalid
Top achievements
Rank 1
answered on 17 Sep 2015, 10:23 AM
I Solve This Problem By Closing an un closed HTML < DIV > inside the ASPX page!!!
0
sachin
Top achievements
Rank 2
answered on 09 May 2019, 07:22 AM

Problem Fixed !!

Scenario

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.

 

Solution

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.

eg:-

radAjaxManager.AjaxSettings.AddAjaxSetting(cmdSubmit, txtAddress, AjaxLoadingPanel1, UpdatePanelRenderMode.Inline)

 

Thanks

Sachin

 

 

Tags
Ajax
Asked by
Andrew Lawrence
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Andrew Lawrence
Top achievements
Rank 1
khalid
Top achievements
Rank 1
sachin
Top achievements
Rank 2
Share this question
or