<%@LANGUAGE="VBSCRIPT" %> <% Response.CacheControl = "no-cache" %>
Lab 2

In this lab, you will use a few controls and write functions to handle user interaction with the controls. The first part will have you manage a lot within the forward-facing aspx file and a little within the code-behind aspx.cs file, while part 2 will have you do extensive C# code in the code-behind aspx.cs file.

Materials to turn in on the server:

  • In your Lab02 folder:
    • index.aspx
    • index.aspx.cs
    • table.aspx
    • table.aspx.cs
    • other associated files, images, etc.

Procedures

  1. Create index.aspx to learn about the IDE and basic functionality
    • View this working solution
    • Create an aspx that has a simple form that requests:
      • first name,
      • last name,
      • city,
      • state,
      • zip code
    • The first name, last name, city, and zip code boxes use the <asp:TextBox> control
    • The state control uses <asp:DropDownList>
      • You can copy state from here and adjust as necessary:
    • Include an <asp:Button> control to submit the information.
    • Create a Label to display your name in using <asp:Label> controls.
    • Create a Label to display the information after submission using <asp:Label> controls.
    • Create a Label for each one of the above controls, except the Button.
    • Inside of the aspx.cs file (Code Behind file), add C# code
      • Include in the Page_Load method a statement that will change the value of the first Label to be your name.
      • Write a function that will execute when the button is clicked
      • In the function, grab the values from the controls and store them into the second Label control.
         
  2. Create table.aspx and table.aspx.cs
    • View this working solution
      • There is no functionality beyond the page loading in the browser. All of the functionality occurs in your code when it is executed on the server, prior to delivering the end result to the browser.
    • Here are some images you can use with this assignment
    • In table.aspx.cs, declare instances of:
      • System.Web.UI.WebControls.Table
      • System.Web.UI.WebControls.TableRow
      • System.Web.UI.WebControls.TableCell
    • In table.aspx, add an asp:Panel inside the div with an ID of myTable
    • In Page_Load()
      • Instantiate new instances of Table, TableRow, and TableCell
      • Add content and formatting to TableCell
      • Use Controls.Add() to:
        • Add TableCell to TableRow
        • Add TableRow to Table
        • Add Table to Panel
    • Recreate this table as best you can
    • Table width = 360
    • Code - not the exact code, but will show you how to create and add table rows, cells, etc.

Grading

Does it work 4 pts
Part 1 8 pts
Part 2 8 pts
Total 20 pts