« Getting WPF/E Intellisense After Using Expression Design | Main

Using ScriptMode = "Debug" in the ASP.NET AJAX ScriptManager

If you're working your way through the ins and outs of ASP.NET AJAX, you'll probably come across the ScriptMode property of the ScriptManager. And it's fairly easy to see what the options are.

ScriptModeOptions.JPG

Now, that's all very well when they're including debug and release versions of the AJAX Extensions themselves, but what does it mean for your own scripts? If I have my own debug and release versions, what do I call 'em, and where do I put 'em? Well, the answer's fairly simple.

If you make a simple external "test.js" file, and add a ScriptReference to it, like so:

 

<asp:ScriptManager ID="ScriptManager1" runat="server" ScriptMode=">

<Scripts>

<asp:ScriptReference Path="test.js" />

</Scripts>

</asp:ScriptManager>

If you then add ScriptMode="debug" (which you can do either on the ScriptManager or as a property of the ScriptReference element) all it does is add "debug." to your file name, before the j.s. So "test.js" just becomes "test.debug.js", an easy way of having a place for all your debug.trace and debug.traceDump calls that you don't want in the finished version.

 

Posted on Friday, November 24, 2006 at 12:06PM by Registered CommenterSimon Allardice | CommentsPost a Comment

PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.
Editor Permission Required
You must have editing permission for this entry in order to post comments.