Wednesday, March 16, 2011

Telerik AJAX unexpected java script error

While ajaxifying our asp.net page we face strange error. i.e. Page call work first time and second time ajax call fail with following javascript error.

Microsoft JScript runtime error: Sys.InvalidOperationException: Could not find UpdatePanel with ID ''. If it is being updated dynamically then it must be inside another UpdatePanel.

This was very strange as we used similar approach in another application that was using old version of telerik controls. We decided to google it and check this in telerik knowledge base. All documentation was pointing toward single code error i.e. We are setting .Visible property of ajax update control to false in first call which cause this error in second ajax call. This was not the case with us. After investing a lot of time in this issues we found out the solution which is was fairly simple and logical :)

The issue was that ajax control (control triggering ajax call ) was not added as ajax updat control. Adding ajax control in Ajax control list simply solve the issue.

Real surprising situation was when we check our project (using older version of telerik) and found that AJAX was working fine even if you dont add ajax control in ajac update control list :D.

No comments:

Post a Comment