logging in or signing up Chapter03 Carmela Download Post to : URL : Related Presentations : Share Add to Flag Embed Email Send to Blogs and Networks Add to Channel Uploaded from authorPOINTLite Insert YouTube videos in PowerPont slides with aS Desktop Copy embed code: (To copy code, click on the text box) Embed: URL: Thumbnail: WordPress Embed Customize Embed The presentation is successfully added In Your Favorites. Views: 246 Category: Education License: All Rights Reserved Like it (0) Dislike it (0) Added: February 20, 2008 This Presentation is Public Favorites: 1 Presentation Description No description available. Comments Posting comment... By: balajiraam (39 month(s) ago) nice Saving..... Post Reply Close Saving..... Edit Comment Close Premium member Presentation Transcript Chapter 3 - Exploring ASP.NET and Web Forms: Chapter 3 - Exploring ASP.NET and Web Forms Web Forms: Web Forms Rendering Programming .NET Framework Extensibility WYSIWYG Code Separation State ManagementTwo Programming Models: Two Programming Models Single file programming model Good for ASP migration Code-behind (double-file) programming model Provides client/server code separationHello World Sample Source: Hello World Sample Source <%@ Page Language="vb" %> <html> <head><title>Hello World Web Page</title></head> <body> <form id="Form1" method="post" runat="server"> <asp:TextBox id="Hi" runat="server"> Hello World </asp:TextBox> <asp:Button id="Button1" runat="server" Text="Say Hi"> </asp:Button> </form> </body> </html>Hello World Browser Source: Hello World Browser Source <html> <head><title>Hello World Web Page</title></head> <body> <form name="Form1" method="post" action="vb.aspx" id="Form1"> <input type="hidden" name="__VIEWSTATE" value="dDwtMTc2MjYxNDA2NTs7Pp6EUc0BOodWTOrpqefKJJjg3yEt"/> <input type="text“ name="Hi" value="Hello World" id="Hi" /> <input type="submit" name="Button1" value="Say Hi" id="Button1" /> </form> </body> </html>Server Tag Changes: Server Tag ChangesServer Controls: Server Controls HTML Server Controls Used when: Migrating existing ASP pages to ASP.NET The Web page requires a great amount of client-side code, where client-side events need to be programmed extensively Web Server Controls More consistent interface Preferred__VIEWSTATE (ViewState): __VIEWSTATE (ViewState) Stores data across calls to the server Holds Primitive types Strings HashTables ArrayListsPost Back: First Request for myPage User fills in form and submits data Http “Get” myPage.aspx ( no data ) Response = myPage.aspx Browser Http “Post” myPage.aspx ( data ) IsPostBack = false IsPostBack = true Web Server Response = myPage.aspx Post BackResponding to Events: Responding to Events <html> <head> <title>Hello World Web Page</title> <script runat="server"> sub ShowDateTime(sender as object, e as EventArgs) lblDateTime.Text = DateTime.Now end sub </script> </head> <body> <form id="Form1" method="post" runat="server"> <asp:label id="lblDateTime" runat="server"></asp:label> <asp:button id="btnSelect" Text="Select" Runat="server" OnClick="ShowDateTime"> </asp:button> </form> </body> </html>Slide11: optional code-behind Base.vb myPage.aspx Request from Browser execute .dll * generate .vb class file * Aspx Engine parse myPage.aspx Language Compiler create .dll file * Yes No Response to Browser optional compiled code-behind pages myProject.dll * Files created within the following folder structure: %SystemRoot%\Microsoft.NET\Framework\version\Temporary ASP.NET Files\ .aspx file changed? No Yes compiled?Slide12: Code-Behind Page: myPage.aspx.vb … Public Class myPage … Protected WithEvents btnSelect As System.Web.UI.WebControls.Button Protected WithEvents txtName as System.Web.UI.WebControls.TextBox … Web Form Page: myPage.aspx <% Page language="vb" Codebehind="myPage.aspx.vb" Inherits="ch3.myPage" %> … <asp:Button id="txtName" Text="MyName" /> <asp:Button id="btnSelect" Text="Select" /> …Slide13: Class Selection Event Method Selection Page Layout: Page Layout Grid Layout Drag and drop controls anywhere Great for fixed size page Flow Layout Similar to traditional ASP Requires tables / nested tables for layout Can also have advantagesLab – Creating a Web Form: Lab – Creating a Web Form You do not have the permission to view this presentation. In order to view it, please contact the author of the presentation.
Chapter03 Carmela Download Post to : URL : Related Presentations : Share Add to Flag Embed Email Send to Blogs and Networks Add to Channel Uploaded from authorPOINTLite Insert YouTube videos in PowerPont slides with aS Desktop Copy embed code: (To copy code, click on the text box) Embed: URL: Thumbnail: WordPress Embed Customize Embed The presentation is successfully added In Your Favorites. Views: 246 Category: Education License: All Rights Reserved Like it (0) Dislike it (0) Added: February 20, 2008 This Presentation is Public Favorites: 1 Presentation Description No description available. Comments Posting comment... By: balajiraam (39 month(s) ago) nice Saving..... Post Reply Close Saving..... Edit Comment Close Premium member Presentation Transcript Chapter 3 - Exploring ASP.NET and Web Forms: Chapter 3 - Exploring ASP.NET and Web Forms Web Forms: Web Forms Rendering Programming .NET Framework Extensibility WYSIWYG Code Separation State ManagementTwo Programming Models: Two Programming Models Single file programming model Good for ASP migration Code-behind (double-file) programming model Provides client/server code separationHello World Sample Source: Hello World Sample Source <%@ Page Language="vb" %> <html> <head><title>Hello World Web Page</title></head> <body> <form id="Form1" method="post" runat="server"> <asp:TextBox id="Hi" runat="server"> Hello World </asp:TextBox> <asp:Button id="Button1" runat="server" Text="Say Hi"> </asp:Button> </form> </body> </html>Hello World Browser Source: Hello World Browser Source <html> <head><title>Hello World Web Page</title></head> <body> <form name="Form1" method="post" action="vb.aspx" id="Form1"> <input type="hidden" name="__VIEWSTATE" value="dDwtMTc2MjYxNDA2NTs7Pp6EUc0BOodWTOrpqefKJJjg3yEt"/> <input type="text“ name="Hi" value="Hello World" id="Hi" /> <input type="submit" name="Button1" value="Say Hi" id="Button1" /> </form> </body> </html>Server Tag Changes: Server Tag ChangesServer Controls: Server Controls HTML Server Controls Used when: Migrating existing ASP pages to ASP.NET The Web page requires a great amount of client-side code, where client-side events need to be programmed extensively Web Server Controls More consistent interface Preferred__VIEWSTATE (ViewState): __VIEWSTATE (ViewState) Stores data across calls to the server Holds Primitive types Strings HashTables ArrayListsPost Back: First Request for myPage User fills in form and submits data Http “Get” myPage.aspx ( no data ) Response = myPage.aspx Browser Http “Post” myPage.aspx ( data ) IsPostBack = false IsPostBack = true Web Server Response = myPage.aspx Post BackResponding to Events: Responding to Events <html> <head> <title>Hello World Web Page</title> <script runat="server"> sub ShowDateTime(sender as object, e as EventArgs) lblDateTime.Text = DateTime.Now end sub </script> </head> <body> <form id="Form1" method="post" runat="server"> <asp:label id="lblDateTime" runat="server"></asp:label> <asp:button id="btnSelect" Text="Select" Runat="server" OnClick="ShowDateTime"> </asp:button> </form> </body> </html>Slide11: optional code-behind Base.vb myPage.aspx Request from Browser execute .dll * generate .vb class file * Aspx Engine parse myPage.aspx Language Compiler create .dll file * Yes No Response to Browser optional compiled code-behind pages myProject.dll * Files created within the following folder structure: %SystemRoot%\Microsoft.NET\Framework\version\Temporary ASP.NET Files\ .aspx file changed? No Yes compiled?Slide12: Code-Behind Page: myPage.aspx.vb … Public Class myPage … Protected WithEvents btnSelect As System.Web.UI.WebControls.Button Protected WithEvents txtName as System.Web.UI.WebControls.TextBox … Web Form Page: myPage.aspx <% Page language="vb" Codebehind="myPage.aspx.vb" Inherits="ch3.myPage" %> … <asp:Button id="txtName" Text="MyName" /> <asp:Button id="btnSelect" Text="Select" /> …Slide13: Class Selection Event Method Selection Page Layout: Page Layout Grid Layout Drag and drop controls anywhere Great for fixed size page Flow Layout Similar to traditional ASP Requires tables / nested tables for layout Can also have advantagesLab – Creating a Web Form: Lab – Creating a Web Form