5. Background Web Architecture Web Server PC/Mac/Unix/... + Browser Client Server Request: http://www.digimon.com/default.asp Response: <html>….</html> Network HTTP, TCP/IP
6.
7.
8. Background <html> <head><title>HelloWorld.asp</title></head> <body> <form method=“post"> <input type="submit" id=button1 name=button1 value="Push Me" /> <% if (Request.Form("button1") <> "") then Response.Write "<p>Hello, the time is " & Now() end if %> </form> </body> </html>
9.
10.
11.
12.
13.
14.
15. ASP.NET Overview HelloWorld.aspx <%@ Page language="c#" %> <html> <head></head> <script runat="server"> public void B_Click (object sender, System.EventArgs e) { Label1.Text = "Hello, the time is " + DateTime.Now; } </script> <body> <form method="post" runat="server"> <asp:Button onclick="B_Click" Text="Push Me“ runat="server“ /> <p> <asp:Label id=Label1 runat="server " /> </form> </body> </html>
16.
17.
18. ASP.NET Overview Architecture Common Language Specification Common Language Runtime VB C++ C# ASP.NET: Web Services and Web Forms JScript … Windows Forms Base Classes ADO.NET: Data and XML Visual Studio.NET
19.
20.
21. Programming Model Controls and Events Browser ASP.NET Button code ... List code ... Text code ... Event handlers Button List Text
22.
23.
24.
25.
26.
27. Programming Model Automatic Browser Compatibility Button code ... Menu code ... Text code ... Event handlers ASP.NET Button Control Menu Control Text Control ... Button Menu Text IE 4 Button Menu Text Netscape Button Menu Text IE 5.5 Button Menu Text IE 6
39. Programming Basics Page Event Lifecycle Page_Load Page_Unload Textbox1_Changed Button1_Click Initialize Restore Control State Save Control State Render 1. Change Events 2. Action Events Page_Init Control Events Load Page Unload Page
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94. Data Binding Templates SeparatorTemplate FooterTemplate HeaderTemplate AlternatingItem- Template ItemTemplate Templates used in Repeater controls
95.
96.
97.
98.
99.
100.
101.
102.
103.
104.
105.
Notas del editor
In this module we will focus on what ASP.NET is, why it was created, and how to do the essential programming tasks. Next time we’ll go into a variety of other aspects of ASP.NET
Have to write code to do anything. There is almost no purely declarative way to do anything.
These two samples do the same thing: bind ListBox1 to the data returned from GetSampleData(), binding the value and text to CategoryID and CategoryName columns, respectively. The first mostly uses code while the second sample mostly uses attributes on the ListBox tag. Both require that the DataBind method be called.