Attention: We are retiring the ASP.NET Community Blogs. Learn more >

Ajax.NET debugging

Most people use alert() to debug their JavaScript, but the Microsoft Ajax Library has a better alterative Sys.Debug. Sys.Debug has some methods for logging messages to the browser console. Like this:

To log a message:
Sys.Debug.trace(“Log to the console”)
To log an object:
Sys.Debug.traceDump(someObject);

You can use Web Development Helper for IE, and Firebug for Firefox to see your console messages. Or use textarea element with the id "TraceConsole" to trace your messages:

<textarea id=”TraceConsolerows=”50cols=”50></textarea>

 

From:

http://weblogs.asp.net/alnurismail/archive/2009/01/12/a-better-alternative-to-using-alert-for-debugging.aspx

1 Comment

Comments have been disabled for this content.