Slide 10.g: Adding simple code to a page (cont.)
Slide 11.a: JavaScript
Home

ASP.NET Programming


  1. Install Essential Downloads of ASP.NET, which consists of two packages:
    • Microsoft .NET Framework and
    • Visual Web Developer 2005 Express Edition.

  2. Activate the Visual Web Developer 2005 Express Edition by selecting the Windows options:
       Start  All Programs  Microsoft Visual Web Developer 2005 Express Edition

  3. Doubly click the hyperlink Create a Web Site in the section Getting Started:


  4. Copy the web site to a site you pick by selecting the following VWD options:
       WebSite  Copy Web Site

  5. Visual Web Developer includes a WYSIWYG, drag-and-drop user interface. Use the active file Default.aspx as a template to start building the web pages by using various toolboxes on the left pane, especially, the Standard toolbox:



    For how to use the Visual Web Developer, check the Guided Tour. An example of a Default.aspx is built as follows:

     C:\ASPNET\WebSite0\Default.aspx 
     
     <html>
     <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb"
       Inherits="_Default" %>
     <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
     <html xmlns="http://www.w3.org/1999/xhtml">
      <head runat="server">
       <title>Web Site 0</title>
       <script language="VB" runat="server">
          Sub Greeting(ByVal Sender As Object, ByVal E As EventArgs)
              Greet.Text = "Hello, " & HttpUtility.HtmlEncode(name.Text)
          End Sub
       </script>
      </head>
    
      <body bgcolor="#ccffff">
       <form id="form1" runat="server">
        <p style="left: 1cm; position: absolute; top: 1cm;">
         <asp:Label ID="Label1" runat="server" Text="Name: "
           Font-Bold="false" Font-Size="Large"></asp:Label>
         <asp:TextBox ID="name" runat="server" Font-Bold="false"
           Font-Size="Large"></asp:TextBox>
         <asp:Button ID="Button1" runat="server" Text="Submit"
           onClick="Greeting" Font-Size="Large" /><br /><br />
         <asp:Label ID="Greet" runat="server" Text="" Font-Size="Large"
           Font-Bold="true"></asp:Label>
        </p>
       </form>
      </body>
     </html>

    For how to write .aspx files, check the ASP.NET Quickstart Tutorial.

  6. Check the web page on a browser by selecting the VWD options:
      Build  Build Web Site
    and
      Debug  Start without Debugging


    Unless there are a web server and an IP address on your machine, you can only check the web pages on the local machine. You can see this by noticing the URL is
      http://localhost:3237/WebSite0/Default.aspx
    For grading, you have to post your code on-line and allow the instructor to download it and execute it on his machine.

  7. Execute the web page and check the result: