Wednesday, July 11, 2007

ASP.NET Response.Redirect Server.Transfer link demo

1. Add a WebForm called MyTable
A. In Project . Properties . Build make sure Option Strict = On
1. Change Designer Defaults . Page Layout to flow
2. Note you will make these changes on every form.
a) See first week notes to set global defaults.
B. Using the HTML view create the table shown below
C. Note: First date is strong, second date is bold
1. Bill Smith is emphazie and Mike White is italics
2. Set Table Cell Padding to 10 and check your Design View
3. Set Table Cell spacing to 10 and Check your Design View
4. The My Cool Table is centered across all columns
5. Hours are right aligned.
D. Write or Type a short explanation of the difference between the cell padding and spacing.
1. I will be looking for this explanation when I grade.
2.
3. From the Book: Pages 102-106, Pages 124-126
A. Screen prints of running application and print code.
4. Add a WebForm called PostBackDemo
A. In Project . Properties . Build make sure Option Strict = On
1. Change Designer Defaults . Page Layout to flow
2. Note you will make these changes on every project.
B. Add a command button (btnSum, text=0) and next to it:
C. Add a drop down list (ddlNames)
5. Code as follows
A. In PageLoad add 3 names to the list
With ddlNames
.Items.Add("Larry")
…..
B. In button click event. Increment the button . text by 1 each time it is clicked.
1. Hint. Convert to Int, Add, then convert back to string.
C. Run and click on button 4 times…so it counts to 4
D. Screen print drop down list with repeating names (
6. Modify as follows
A. Add an “If NOT Page.IsPostback then…. To page load around the ddlNames code.
B. Run and click on button 4 times and show screen print the ddlNames with only 3 names.
7. In Global.asax
A. In session_start initialize a session variable called SessionMapPath = Server.MapPath(“”)
B. Add a label under the sum button on the above page to display this variable.
C. Run, screen print and circle the MapPath.
8. Add a new Web Form Called LinkDemo
A. Add a label called lblCurrentSystemUser
1. = System.Environment.UserName (should be ASPNET)
9. Place two links on PostBackDemo to LinkDemo
A. btnLinkDemo is a link button coded with:
1. Response.Redirect to LinkDemo ,
a) Screen print and circle the URL
2. Server.Transfer to LinkDemo
a) Screen print the URL and explain the difference
B. hypLinkDemo is a simple hyperlink to LinkDemo
1. Not code… just properties.