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

JavaScript runtime error: Unable to get property UI of undefined or null reference

6 Answers 575 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Mickael
Top achievements
Rank 1
Mickael asked on 05 Oct 2014, 07:00 PM
Hi,

I get this error since I started to use Telerik controls a couple hours ago.

 JavaScript runtime error: Unable to get property 'UI' of undefined or null reference

The exception occurs on the following line:

   
$create(Sys.Extended.UI.ModalPopupBehavior, {"BackgroundCssClass":"modalBackground","DropShadow":true,"PopupControlID":"Pnl_ForAdd","dynamicServicePath":"/Main.aspx","id":"MdlPppXtndr_Add_ID"}, null, null, $get("DummyForAdd"));


One my page I use Ajax for the modal popups and update panels.
I did as people suggested in other posts, and used the design to register Telerik in the web.config as follow:

<system.web>
...
    <httpHandlers>
      <add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false" />
    </httpHandlers>
...
</system.web>

<system.webServer>
...
<handlers>
      <add name="Telerik_Web_UI_WebResource_axd" verb="*" preCondition="integratedMode" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" />
</handlers>
...
</system.webServer>

<location path="Telerik.Web.UI.WebResource.axd">
    <system.web>
      <authorization>
        <allow users="*" />
      </authorization>
    </system.web>
  </location>

On my page I register the scriptmanager like this:
           
<telerik:RadScriptManager ID="RadScriptManager1" runat="server" EnablePageMethods="True"></telerik:RadScriptManager>

So now I am at a loss about what to do to make this work, and in a hurry to get things working because of deadlines.

6 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 07 Oct 2014, 09:56 AM

Hi Mickael,

This $create() statement is not for our controls but from the AjaxControlToolkit controls and I suggest taking a look in the net for solutions. For example, here is a similar problem: http://stackoverflow.com/questions/14562451/microsoft-jscript-runtime-error-sys-extended-ui-is-null-or-not-an-object.

The AjaxControlToolkit are not something we support but I feel obliged to note that they are not compatible with the asp:ScriptManager controls (and, by extension, with RadScriptManager). This was a breaking change on their end (see this sticky thread: http://www.telerik.com/forums/telerik-ui-for-asp-net-ajax-and-ajax-control-toolkit), and so far the only workaround we know of is to use the toolkit scriptManager. This, however, means that they can break our controls and we cannot do anything about it.

All that being said, what I suggest is the following:

I hope this helps get you started.


Regards,

Marin Bratanov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Mickael
Top achievements
Rank 1
answered on 07 Oct 2014, 12:04 PM
Hi Marin,

thanks again for your help.

I removed all the Ajax and started to move everything to Rad controls.
It will take a bit of time to get everything back to normal, but so far, it looks like it is actually working better than before.
The only 'issue' is to find how to do what I want to do.
But for this, I am reading a lot your tutorials.
So I should be ok :)
0
KidSysco
Top achievements
Rank 1
answered on 18 Feb 2015, 09:24 PM
If this is true, then how do you explain the following guidance?

http://www.telerik.com/help/aspnet-ajax/troubleshooting-radscriptmanager.html

Microsoft JScript runtime error: AjaxControlToolkit requires ASP.NET
Ajax 4.0 scripts. Ensure the correct version of the scripts are
referenced. If you are using an ASP.NET ScriptManager, switch to the
ToolkitScriptManager in AjaxControlToolkit.dll. Resolution for .NET 4.0 projects:Upgrade the RadControls for ASP.NET AJAX version 2010.1.625 or newer.Important: Make sure you use the .NET 4.0 build of both Telerik.Web.UI.dll and AjaxControlToolkit.dllIf upgrade is not option you can use the following workaround:
0
Marin Bratanov
Telerik team
answered on 19 Feb 2015, 10:45 AM

Hello Ryan,

I explain it with the fact that this has been a solution for previous problems they cause in old versions of theirs. This would still hold true for older versions of the AjaxControlToolkit.

I will update the article to note that newer version of the ACT break even this.

We had put a lot of effort into working around problems and limitations they cause, but some things are simply impossible (i.e., when they decided to break compatibility with the asp:ScriptManager) and there is nothing we can do about them.

Regards,

Marin Bratanov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
KidSysco
Top achievements
Rank 1
answered on 19 Feb 2015, 01:52 PM
I am still a bit confused. Here is my experience...

This is an old solution dating back to 2010, no idea how it got here, I inherited it last year.

This week, I Upgraded the Telerik Controls in it to the latest version in order to fix a bug.

I tried to use the RadAutoComplete  and it is throwing JS errors.

So using the link I posted above, I did what was suggested and I upgraded ACT from NuGet and RadAutoComplete still did not work. Throwing JS errors still.

So then I did what was suggested here and I removed ACT from the solution completely.

This broke everything, not just the RadAutoComplete.

I used NuGet to add ACT back into the project, everything is working again but the RadAutoComplete.

Now I was under the assumption that the RadAjax Controls inherited from ACT in nearly every case. Based on my experiences with this app, it is true and the Telerik Controls will need ACT in order to run.

So I do not understand why you would suggest removing ACT entirely or why that would help.

This app is nearly entirely done using the Telerik Controls. There is very little use of ACT. I would get rid of ACT if you thought it was the problem but it doesn't seem to work.

Any insight you have is appreciated.

0
Marin Bratanov
Telerik team
answered on 19 Feb 2015, 02:34 PM

Hi Ryan,

The Telerik UI for ASP.NET AJAX controls do NOT inherit the AjaxControlToolkit controls. They never have, and they do NOT require the AjaxControlToolkit in order to function. I am stressing this heavily to make sure there is no confusion on the matter.

The Telerik controls are built on top of the vanilla MS AJAX framework and this is their only requirement as you can see in our documentation: http://www.telerik.com/help/aspnet-ajax/introduction-adding-to-app-with-vs.html#requirements.

The AjaxControlToolkit is a separate project, similar to ours (i.e., it started out as controls based on MS AJAX), but it is free and community-based. In later years, however, they have been moving away from the core framework and have been introducing more and more problems. They have always caused issues because they bring modified versions of the core MS AJAX scripts. These two are the main reasons why I advise against using them in the same project as our controls. We simply have no control over ACT and we cannot know what they can break.

Now, back to your project and experience:

  • Removing the ACT is likely to break your project, because many references may still remain (e.g., Register directives, control tags, etc.). There is no reason for anything else but the ACT specific code to break.
  • The errors with RadAutoCompleteBox - I advise opening a ticket or a forum thread in the AutoCompleteBox forum where you can showcase your problem so you can get assistance with that concrete issue. It is possible that it has nothing to do with ACT, but is some generic misconfiguration, unrelated to this case. It is vital that you explain what the errors are, what is their stack trace and that you provide the steps that reproduce the problem so it can be tackled. A JS error can be caused by a variety of things and without concrete information on the problem we can only guess, and this is not very effective.

 

Regards,

Marin Bratanov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
General Discussions
Asked by
Mickael
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Mickael
Top achievements
Rank 1
KidSysco
Top achievements
Rank 1
Share this question
or