So here I was on a Friday afternoon with another doozy of an error. I recently needed to make a modification to an existing web application we wrote. The original developer had left the company and I had to take this project over for the change. The forms make use of Ajax, so I duly went ahead and installed the Ajax Control Toolkit via NuGet. I then started seeing the following error: ‘JavaScript runtime error: Unable to get property ‘UI’ of undefined or null reference’. I saw that a modal popup caused this error. I wasn’t too surprised as I had expected some errors, but the solution however did surprise me.
JavaScript Runtime Error
Well there is not much to say about this solution. Here is the screen that pops up.
Some sources on the Internet said that one needs to set the CombineScripts property to False, but I didn’t think that would be a solution, but rather a workaround. Then there was a solution offered by masterw that worked like a charm.
replace
<asp:ScriptManager ID=”ScriptManager1″ runat=”server”>
</asp:ScriptManager>
with
<ajaxToolkit:ToolkitScriptManager ID=”ToolkitScriptManager1″ runat=”server”>
</ajaxToolkit:ToolkitScriptManager>
After I did this, the error stopped and my pages (and modal popup dialogs) started working again. If anyone has a nice explanation as to why this worked, please let me know in the comments.