Showing posts with label ajax. Show all posts
Showing posts with label ajax. Show all posts

Monday, March 05, 2007

JSON.JS and ASP.NET AJAX Extension

JSON.JS was always an important part of my JavaScript library. But, after I start using ASP.NET AJAX extension, I found out that there is a conflict between JSON.JS and AJAX extension.

What is wrong:
On one web page with both AJAX extension control "Accordion" and JSON.JS. I get these error message during page load:
  • Sys.Res has no properties
  • Sys.Application has no properties
  • Sys.UI.DomEvent has no properties

If I edit web.config, change debug="true" to debug="false", these loading errors disappear. But, I found Accordion's performance is very bad. The whole page is held up for at least 10 seconds after each click.

Now "Firebug" comes for the rescue. The "profile" tool in Firebug is very easy to use. It only took me 2 minutes to find out the offender. Just switch to "Console" tab, and click on "Profile", then start clicking on the page. After I am done, I click on "Profile" button again to stop profiling and see the report of activities. Not surprisingly, "toJSONString" is number 1 CPU consumer (see screen shot below). So, the conclusion is obvious, JSON.JS cannot live in the same space as AJAX extension.




Work around:
Now that AJAX extension does not like JSON.JS, and they DO have an alternative to JSON.JS. A reasonable work around is to stop using JSON.JS, and start use the functions provided in Microsoft AJAX library. So here are the alternatives: Sys.Serialization.JavaScriptSerializer.serialize
Sys.Serialization.JavaScriptSerializer.deserialize

By doing this, did I fell into one of Microsoft's secret agenda?

Tuesday, January 23, 2007

ASP.NET AJAX 1.0 released

From Atlas to ASP.NET AJAX, this nice development tool is finally released, and it is free. For ASP.NET developers, this is the time to seriously check it out. It is a huge enhancement to ASP.NET in Visual Studio 2005.

The official web site for this product: http://ajax.asp.net/default.aspx

Also check this blog for more behind scene information: http://weblogs.asp.net/scottgu/archive/2007/01/23/asp-net-ajax-1-0-released.aspx
(Scott is a Microsoft employee. His blog is one of the few I subscribe to. It has latest news about ASP.NET, IIS, and lots of tutorials.)