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.
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.

Reader Comments