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

Random error in radalert

7 Answers 209 Views
Window
This is a migrated thread and some comments may be shown as answers.
Swati
Top achievements
Rank 1
Swati asked on 17 Aug 2011, 05:53 PM
I use the following javascript to create a radalert :
<script language='JavaScript'> function f(){var oWnd=radalert('The record is successfully saved!',300,100,'RecordSaved',null);oWnd.add_close(function () {returnToParent();});Sys.Application.remove_load(f);}; Sys.Application.add_load(f); </script>

The issue is at times it throws an error like :Unable to get value of the property 'toLowerCase': object is null or undefined" on 
if(d&&d.tagName.toLowerCase()!="body")
Please see attached jpeg for exact description.
Also, sometimes it throws no error but don't display radalert at all.
These are random errors and do not happen every-time and has not particular pattern of occurrence.

Can anyone please tell me why it happens and how can I fix this. This is a very important part of my project as I use the same script on various pages and get same error on each.

Thanks,
Swati

7 Answers, 1 is accepted

Sort by
0
BekirSami
Top achievements
Rank 1
answered on 18 Aug 2011, 12:36 PM
Hello,

I have same Error. Have you solution? I changed  new Telerik version in my project, then had I this problem.
0
Marin Bratanov
Telerik team
answered on 19 Aug 2011, 02:44 PM
Hi guys,

We recently discovered an issue under IE when you try to access the document.activeElement object when your page is loaded in an iframe and you try to access it in the Sys.Application.Load event, which is exactly what seems to be happening here (since you inject it from the server). This seems to be some incorrect browser behavior and there is little we can do to avoid it.

I have one suggestion, though. It is to set an active element beforehand, so that when we try to access it it will provide a valid value. For example this at the end of the form:
function setSomeFocus()
{
    window.document.documentElement.focus();
    Sys.Application.remove_load(setSomeFocus);
}
Sys.Application.add_load(setSomeFocus);
  You can, of course, focus some other element from your form :)

I hope this will resolve the situation. If it doesn't I'm afraid I'll need some working code to examine the error and see how to work around it, but this can happen only if I can reproduce it reliably.


Regards,
Marin
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
BekirSami
Top achievements
Rank 1
answered on 20 Aug 2011, 10:56 AM
Hi,

Thanks for the information, but I have in javascript  the  "Sys is undefined" error now. Why wasn't there the "'toLowerCase': object is null or undefined" error in old Telerik version? 
0
Swati
Top achievements
Rank 1
answered on 22 Aug 2011, 03:08 PM
Thanks for the response. But I tried focusing on the element but the behavior is still inconsistent. My radalert is inside a rad window and returntoparent() method on close actually closes the rad window. If I don't use add_close() method then it works fine. Can you please tell me how can I define a method for OK button of radalert instead of using add_close().
Thanks in advance.
0
Marin Bratanov
Telerik team
answered on 22 Aug 2011, 04:00 PM
Hi guys,

@Hasan: This error is a general ASP.NET one and is often caused by a project that is not configured properly. Please examine the following help article for more information on troubleshooting it: http://www.telerik.com/help/aspnet-ajax/introduction-troubleshooting.html. Or you could start from this google search on the matter: http://www.google.com/search?&q=sys+is+undefined.

@Swati: Please try using the RadAlert's callback function instead of adding event handlers dynamically. You can see an example of its usage in this online demo and in the documentation. You could modify the dialog template, but overriding the ok button handler would mean you should first store a reference to the RadAlert in a global variable so you can close() it manually. Alternatively, you could use a normal RadWindow (modal, with limited Behaviors, etc) with the desired layout in its ContentTemplate where you can easily attach JavaScript handlers.


Kind regards,
Marin
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
BekirSami
Top achievements
Rank 1
answered on 23 Aug 2011, 07:56 AM
Hi,

I changed web.config  for this error ( "Sys is undefined"). But I take Config Error. I added in web.config this:

<httpHandlers>  
<add path="trace.axd" verb="*" type="System.Web.Handlers.TraceHandler" validate="True" />
<add path="WebResource.axd" verb="GET" type="System.Web.Handlers.AssemblyResourceLoader" validate="True" /> 
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/> 
<add path="*.axd" verb="*" type="System.Web.HttpNotFoundHandler" validate="True" />   

</httpHandlers>


0
Marin Bratanov
Telerik team
answered on 24 Aug 2011, 08:39 AM
Hello Hasan,

I would advise that you start off by examining the following list of help articles that contain useful information on installing the MS  AJAX framework and configuring your project for it:
http://www.telerik.com/help/aspnet-ajax/introduction-which-file-do-i-need-to-install.html
http://www.telerik.com/help/aspnet-ajax/introduction-general-aspnetajax-info.html
http://www.telerik.com/help/aspnet-ajax/introduction-adding-radcontrols-prometheus-existing-application.html
http://www.telerik.com/help/aspnet-ajax/introduction-adding-to-app-with-vs.html

Once you have AJAX properly installed you can use our visual studio extensions to create an AJAX-enabled web site that will have the necessary handlers for our controls as well. More information on the VS plugins is available here: http://www.telerik.com/help/aspnet-ajax/introduction-adding-to-app-with-vs.html.


All the best,
Marin
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Tags
Window
Asked by
Swati
Top achievements
Rank 1
Answers by
BekirSami
Top achievements
Rank 1
Marin Bratanov
Telerik team
Swati
Top achievements
Rank 1
Share this question
or