spacer
Yehuda Shiran August 25, 2002
Debugging JScript .NET within ASP.NET
Tips: August 2002

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
Google Chrome Playing Catch-Up on Extensions
Open Solutions Alliance Gets New Leadership
Red Hat Spacewalk Expands Linux Management
You can use the <%= %> construct to debug JScript .NET sections in your ASP.NET pages. The following example displays the variable name:

  <%@ Page LANGUAGE="JScript" SRC="col116ex5.aspx.js" INHERITS="COL116.codeBehind" 
    AutoEventWireup="true" EnableViewState="true"%>
  <HTML>
  <SCRIPT LANGUAGE="JScript" runat="server">
  var name : String = "This line is set by JScript";
  </SCRIPT>
  <HEAD>
    <TITLE>Hello World Test</TITLE>
  </HEAD>
  <BODY STYLE="font-size:12; font-family:arial,verdana,sans-serif;">
    <P ALIGN="center">Hello, <%= name %></P>
    <FORM RUNAT="server">
    <P ALIGN="center"><ASP:LABEL ID="message" RUNAT="server"></ASP:LABEL></P>
    </FORM>
  </BODY>
  </HTML>
The Code Behind JScript .NET code associated with the above ASP.NET page displays the message "Hello World, Code Behind" by setting the Text property of the ASP:Label message. See tip 020824.html for the exact code listing.

We called the above ASP.NET page col116ex5.aspx. We put it in the directory d:\aspDemo, which is the virtual directory column113 of our IIS Web server. If you follow those same steps, you can display the ASP.NET page in your browser by setting the URL to http://localhost/column113/col116ex5.aspx. You should get the following page:

As you can see, there are two messages on the page. The top one is displayed by the <%= %> construct for debugging messages. The bottom one is displayed by the Code Behind code, as part of the application.

To learn more about JScript .NET and ASP.NET, go to Column 116, JScript .NET, Part X: Displaying Information.


People who read this tip also read these tips:

Look for similar tips by subject:

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

webref The latest from WebReference.com Browse >
Administering MySQL Databases on the Web Using PHP · Popular JavaScript Framework Libraries: An Overview - Part 3 · Accessing Your MySQL Database from the Web with PHP
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
So what is an Oracle Nested Table? · E-Discovery Architectures 101 · eBay Embraces Big Sellers, Cyber Monday Trends