Microsoft JScript runtime error: Unable to get value of the property 'radalert': object is null or undefined IE8

StackOverflow https://stackoverflow.com/questions/14158455

Question

I am calling a RadAlert through server side Java Script in code behind file of an ASP.NET application. This RadAlert is working fine with IE7, IE9, Chrome and Firefox but IE8 throwing exception of 'Microsoft JScript runtime error: Unable to get value of the property 'radalert': object is null or undefined'. Could please anyone tell me how I can resolve this issue. Following is the code

string dialogMessage = "Record " + Session["SavedRecordID"].ToString() + " Saved Successfully";
string radalertscript = "<script language='javascript'> window.onload = function() {var oWnd = radalert('" + dialogMessage + "', 400, 140, 'Saved'); window.setTimeout(function () { oWnd.Close(); }, 3000);} </script>";
Page.ClientScript.RegisterStartupScript(this.GetType(), "radalert", radalertscript);

Thanks.

Était-ce utile?

La solution

It's possible that the building up of the radalert object is happening too late in IE 8. Since ASP.NET AJAX components use possibly a different lifecycle, you could also try (at least to eliminate whether what I'm saying is the actual problem):

Sys.Application.add_load(function(sender, e) {
  var oWnd = radalert('" + dialogMessage + "', 400, 140, 'Saved');
  window.setTimeout(function () { oWnd.Close(); }, 3000);}
});

You should be able to render this from the server and it function the same.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top