CS 233S: Web Application Development II	Name:	
Assignment #2: Server Controls & Client-Side Scripts	Date Due:	

In this second assignment, you will move from the big picture of what it means to work with an object oriented, class driven, event driven programming technology like ASP.NET and begin to nail down some specifics. You will explore the differences and similarities between web server controls and HTML server controls and how to combine client-side and server-side scripting on a single page.
Part A: Text Reading	50 points
1.	Read Chapter 2 in the textbook. Complete either the VB or C# coding for each of the following:
•	Page 75, Listing 2-5: create the file shown and save as chap2page1.aspx.
•	Page 79, Listing 2-6: modify chap2page1.aspx; add the Page_Load event handler and meta tag
•	Page 81, Listing 2-8: modify chap2page1.aspx; add the JavaScript snippet and textbox control as shown – but modify the id of the textbox from TextBox1 to txtDate. This means that the JavaScript snippet will need to be:
onload="javascript:document.forms[0]['txtDate'].value=Date();"
•	Page 82, Listing 2-9: modify chap2page1.aspx; add the two additional lines of code to the existing Page_Load event handler and add another button to the form. Please provide an id value of btnGreet for the new button control (since Button1 already exists)
•	Page 84, Listing 2-10: create a new file named chap2page2.aspx; add the ASP textbox control shown just above listing 2-10 to the form. 
•	Page 84, Listing 2-11: modify chap2page2.aspx; replace the error-prone code from 2-10 with the correct version in 2-11
•	Page 88. Listing 2-13: create the RandomNumber.aspx and its associated Code Behind file
•	Page 93, Listing 2-14: create the WSCallback.aspx and its associated Code Behind file. Note that to work with a web service, a web reference must be added to your website project. Right click the project name and select Add web reference... Type http://ws.cdyne.com/WeatherWS/Weather.asmx?wsdl in the URL box and type Weather in the Web reference name textbox. (The web service referenced by the textbox no longer exists. The CDYNE service is fairly equivalent, but it has different names for the methods it exposes. Modify the code for the RaiseCallbackEvent procedure as follows:
'create an instance of the weather object from the web service
Dim ws As Weather.Weather = New Weather.Weather()
'use the appropriate web service method to extract the info for our zip code
Dim myWeather As Weather.WeatherReturn = ws.GetCityWeatherByZIP(eventArgument)

'output the temperature property of the WeatherReturn object
_callbackResult = myWeather.Temperature
•	Page96, Listing 2-15: create the file shown as chap2page3.aspx
•	Page 98. Listing 2-16: create the code behind file for chap2page3.aspx
Note that to successfully complete the dynamically populated table on Chap2Page3.aspx you will need to add a copy of the Northwind.mdf file to the App_Data folder for the project. Check Blackboard for a file download and additional instructions.
2.	Email or print the code view from:
•	
•	Chap2page1.aspx
•	Chap2page2.aspx
•	RandomNumber.aspx and the code behind (the .aspx.vb or .aspx.cs file)
•	WSCallback.aspx and the code behind (the .aspx.vb or .aspx.cs file)
•	Chap2page3.aspx and the code behind (the .aspx.vb or .aspex.cs file)

Part B: On Your Own	50 points
1.	Continue building pages for your project site, or create a sample page unrelated to your project that meets the following requirements: 
a.	The page contains enough content to make its main topic and function clear to the viewer
b.	Your name in placed in an author meta tag in the head section of the page
c.	The page formatting is primarily accomplished through external Cascading Style Sheet(s)
d.	The page contains a form that has at least 3 textboxes, at least one button, and at least one area of output. When users enter data into the textboxes a confirmation message appears in the output area. Whether users do or do not click a button to generate the output is up to you.
e.	The page uses a client-side JavaScript of some kind that is placed onto the page through the server-side use of Page.ClientScript.RegisterClientScriptBlock or RegisterStartupScript or RegisterClientScriptInclude
2.	Email or print the code view and browser view of your .aspx file, the code behind file, and the code from the CSS file(s)