10.02.2014 Views

Beginning Ajax With ASP.NET (2006).pdf

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Try It Out<br />

Client-Side Script Debugging<br />

To test this, create a new web site project within Visual Studio .<strong>NET</strong>. Create a new web form/<strong>ASP</strong>X page,<br />

or alternatively edit the Default.aspx page within the project. Remove the existing <br />

declaration and everything contained within those tags, and replace it with the following code:<br />

<br />

<br />

Test Script Debugging<br />

<br />

function DoSomeWork()<br />

{<br />

var cntrl = document.getElementById(“txtInput”);<br />

var number = cntrl.value;<br />

number++;<br />

}<br />

var newValue = DoSomeMoreWork(number);<br />

alert(“New Value = “ + newValue);<br />

function DoSomeMoreWork(arg)<br />

{<br />

// Do some calculations<br />

arg = arg * 2 + 32;<br />

arg = arg + 18 / 2;<br />

}<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

Debugging<br />

Ensure that the newly created page is set as the Startup Page within Visual Studio by right-clicking on<br />

the page with the mouse and selecting Set as Start Page.<br />

Click the Play button, shown in Figure 13-6 (ensure that the active configuration is set to Debug), or<br />

press F5 to launch the application in debug mode.<br />

Figure 13-6<br />

335

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!