Unit 5: Building Presentation Layer Applications with ASP.NET 2.0
Overview Data Source Controls Retrieving Relational Data Data Binding with Relational Data Retrieving XML Data Demonstration: RAD Data Binding in ASP.NET 2.0 Master Pages Site Navigation Themes Membership and Role Management ASP.NET Web Site Administration Tool Lab 5A: RAD Data Binding in ASP.NET 2.0 Lab 5B: Programming Master Pages, Site Navigation, and Themes Lab 5C: Membership and Role Management in ASP.NET 2.0 Lab Discussion
Data Source Controls ASP.NET Page SqlDataSource XmlDataSource Data Bound Control RDBMS XML File SiteMapDataSource AccessDataSource ObjectDataSource Business Object Site Map Access Database
Retrieving Relational Data To use a SqlDataSource control: Add a SqlDataSource control to a page 1 1 Specify the return type 3 3 Configure caching 4 4 Configure the SqlDataSource control 2 2
Data Binding with Relational Data Binding a GridView Control Sorting and Paging Enabling Data Modifications Displaying Master-Details Data
Retrieving XML Data Retrieving XML Data with an XmlDataSource Control: DataFile: The XML file containing the data SchemaFile: An XML schema for the data TransformFile: An XSLT stylesheet XPath: An XPath expression to filter the data DataFile: The XML file containing the data SchemaFile: An XML schema for the data TransformFile: An XSLT stylesheet XPath: An XPath expression to filter the data Binding XML Data to a TreeView Control: Create explicit node bindings Set TextField and ValueField properties Create explicit node bindings Set TextField and ValueField properties
Demonstration: RAD Data Binding in ASP.NET 2.0 In this demonstration, you will see how to: Use the SqlDataSource and GridView controls Use the XmlDataSource control
Master Pages Master pages: Use the directive Specify standard page layout and content for a set of content pages Contain named regions (content placeholders) where content pages can display custom content Content pages: Identify a single master page using the MasterPageFile attribute of directive Implement content to fill content placeholders specified in master Provide programmatic access to the controls and public members of their master page Nested master pages enable the creation of page hierarchies to modularize standard layout and content Visual Studio 2005 supports the creation and graphical editing of master and content pages
Site Navigation Site Map Describes logical site structure Stored in any type of data store for which a site map provider exists Site Map Provider Follows “Provider Pattern” (must extend SiteMapProvider class) Provides link between Site Map and SiteMap object model XML provider uses Web.sitemap file (standard/default SiteMapDataProvider) SiteMap object model (SiteMap and SiteMapNode classes) Uses replaceable provider to access Site Map data Provides run-time access to navigation data for SiteMapPath and SiteMapDataSource controls, as well as custom controls and programs SiteMapDataSource control provides bridge between SiteMap and standard data-bindable controls Tree controls – TreeView (new), Menu (new), … Flat controls – ListBox, BulletedListBox (new), …
Themes Skin Collection of property values that define the visual appearance of a specific type of control e.g. Button, Calendar, or GridView Defined using standard ASP.NET control syntax but with a reduced property set Theme Named collection of skins, images, and style sheets Specified at the page level directive to apply appropriate skins and styles to all controls on the page Specified at site or folder level using Web.config to affect all pages within scope Programmable at run time to offer enhanced customization and personalization capabilities
Membership and Role Management Membership system Solves common credential storage problem Replaces complex authentication code Functionality packaged in server controls User Management Validate credentials Create, Delete, Update Role Management Create, Delete, Update IsUserInRole / Roles for User
ASP.NET Web Site Administration Tool
Lab 5A: RAD Data Binding with ASP.NET 2.0 Exercise 1: Creating a Stock Monitoring Web Application Exercise 2: Adding Interactivity to the Web Application Exercise 3: Creating a Details View Exercise 4: Enabling Data Updates Exercise 5: Creating a Contacts List
Lab 5B: Programming Master Pages, Site Navigation, and Themes Exercise 1: Creating Master and Content Pages Exercise 2: Creating Departmental Master Pages Exercise 3: Implementing Site Navigation Exercise 4: Implementing Themes and Skins
Lab 5C: Membership and Role Management in ASP.NET 2.0 Exercise 1: Manage User Accounts for Forms Authentication Exercise 2: Display Alternate Content to Logged-On Users Exercise 3: Add Registration and Password Management Forms to the Web Site Exercise 4: Control Access to Content by Using Roles