120 likes | 236 Views
CIS 375—Web App Dev II. ASP .NET 2 Introducing Web Forms. What is ASP.NET Web Forms?. The ASP.NET Web Forms page framework is a scalable common language runtime programming model that can be used on the server to dynamically generate Web pages. The ASP.NET Web Forms framework provides:
E N D
CIS 375—Web App Dev II ASP .NET 2 Introducing Web Forms
What is ASP.NET Web Forms? • The ASP.NET Web Forms page framework is a scalable common language runtime programming model that can be used on the server to dynamically generate Web pages. • The ASP.NET Web Forms framework provides: • The ability to create and use reusable UI controls that can encapsulate common functionality and thus reduce the amount of code that a page developer has to write. • The ability for developers to cleanly structure their page logic in an orderly fashion (not "spaghetti code"). • The ability for development tools to provide strong WYSIWYG design support for pages (existing ASP code is opaque to tools).
Writing Your First Web Forms Page • ASP.NET Web Forms pages are text files with an ______ file name extension. • An ASP.NET page can be created by taking an existing HTML file and changing its file name extension to .aspx. • VB Intro1.aspx [Run Sample] | [View Source] .aspx
Using ASP <% %> Render Blocks • ASP.NET provides syntax compatibility with existing ASP pages including support for _________ code render blocks. • VB Intro2.aspx [Run Sample] | [View Source] • Important: Unlike with ASP, the code used within the above <% %> blocks is actually compiled--not ___________ using a script engine, resulting in improved performance. • ASP.NET page developers can utilize <% %> code blocks to dynamically modify HTML output much as they can today with ASP. • VB Intro3.aspx [Run Sample] | [View Source] <% %> interpreted
Introduction to ASP.NET Server Controls • Instead of using <% %> code blocks to program dynamic content, ASP.NET page developers can use ASP.NET server controls to program Web pages. • Server controls are declared within an .aspx file using custom tags or intrinsic HTML tags that contain a runat=“_______" attribute value. • VB Intro4.aspx [Run Sample] | [View Source] | [ads.xml] • Note also that no _______-side script is required. • ASP.NET enables developers to utilize richer custom controls on their pages, such as the <asp:adrotator> control. (see Server Controls) • VB Intro5.aspx [Run Sample] | [View Source] server client
Handling Server Control Events • Each ASP.NET server control is capable of exposing an _______ model containing properties, methods, and events. • ASP.NET developers can use this object model to cleanly modify and interact with the page. • VB Intro6.aspx [Run Sample] | [View Source] • This simple sample is functionally equivalent to the "Intro3" sample demonstrated earlier in this section. • Note, however, how much cleaner and easier the code is in this new server-control-based version. object
Using Custom Server Controls 45 • ASP.NET ships with ____ built-in server controls that can be used out of the box. • See Web Forms Controls Reference • Developers also can use controls developed by ______-party vendors. • The following sample shows a simple calendar control. • VB Intro7.aspx [Run Sample] | [View Source] | [Acme.vb] • This Calendar control performs "uplevel-like" processing on IE 5.5 (doesn’t require round trips back to the server when doing calendar navigation) and "downlevel" processing on all other browsers. third
Lists, Data, and Data Binding • ASP.NET has a built-in set of data _____ and list controls for UI driven from queries against a __________ or other data source. • The following demonstrates how to use the <asp:datagrid runat=server> control. • VB Intro8.aspx [Run Sample] | [View Source] • The <asp:datalist runat=server> control enables end users to exactly control the structure and layout of each item within the list (using the ItemTemplate template property). • VB Intro10.aspx[Run Sample] | [View Source] grid database
Form Validation Controls 1 validation • ASP.NET provides a set of ___________ server controls to check input forms for errors, and display messages to the user. • There are controls for specific types of validation, such as _______ checking or pattern matching, plus a RequiredFieldValidator. • The following demonstrates how to use two <asp:requiredfieldvalidator runat=server> controls. • VB Intro11.aspx [Run Sample] | [View Source] range
Form Validation Controls 2 • Validation controls have both ________ (validation on the client and on the server) and downlevel client support (only on the server). • ASP.NET page developers can check the Page.IsValid property at run time to determine whether all validation server controls on a page are currently valid. • This provides a simple way to determine whether or not to proceed with business _______. • VB Intro12.aspx [Run Sample] | [View Source] uplevel logic
Code-Behind Web Forms • ASP.NET supports two methods of authoring dynamic pages. • The first is the method shown in the preceding samples, where the page code is physically declared within the originating ______ file. • An alternative approach--known as the code-behind method--enables the page code to be more cleanly separated from the HTML content into an entirely separate file. • VB Intro13.aspx [Run Sample] | [View Source] | [Intro13.vb ] .aspx
Summary Web • ASP.NET _____ Forms provide an easy and powerful way to build dynamic Web UI. • ASP.NET Web Forms pages can target any ________ client (there are no script library or cookie requirements). • ASP.NET Web Forms pages provide syntax compatibility with existing _____ pages. • ASP.NET _______ controls provide an easy way to encapsulate common functionality. • ASP.NET ships with ___ built-in server controls. Developers can also use controls built by third parties. • ASP.NET server controls can automatically project both uplevel and ___________ HTML. • ASP.NET _________ provide an easy way to customize the look and feel of list server controls. • ASP.NET __________ controls provide an easy way to do declarative client or server data validation. browser ASP server 45 downlevel templates validation