Title: Unit 5: Building Presentation Layer Applications with ASP.NET 2.0
1Unit 5 Building Presentation Layer Applications
with ASP.NET 2.0
2Overview
- 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
3Data Source Controls
XML File
ltxmlgt
XmlDataSource
Business Object
Access Database
AccessDataSource
ObjectDataSource
ASP.NET Page
SqlDataSource
SiteMapDataSource
RDBMS
Site Map
4Retrieving Relational Data
To use a SqlDataSource control
Add a SqlDataSource control to a page
1
Configure the SqlDataSource control
2
Specify the return type
3
Configure caching
4
5Data Binding with Relational Data
- Binding a GridView Control
- Enabling Data Modifications
- Displaying Master-Details Data
6Retrieving 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
Binding XML Data to a TreeView Control
- Create explicit node bindings
- Set TextField and ValueField properties
7Demonstration 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
8Master Pages
- Master pages
- Use the new _at_master directive
- Specify standard page layout and content for a
set of content pages - Contain named regions (content placeholders)
where contentpages can display custom content - Content pages
- Identify a single master page using the
MasterPageFile attributeof the _at_page directive - Implement content to fill content placeholders
specified in master - Provide programmatic access to the controls and
public membersof 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
graphicalediting of master and content pages
9Site 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),
10Themes
- Skin
- Collection of property values that define the
visual appearanceof a specific type of control
e.g. Button, Calendar, or GridView - Defined using standard ASP.NET control syntax but
with areduced property set - Theme
- Named collection of skins, images, and style
sheets - Specified at the page level using _at_page directive
to apply appropriate skins and styles to all
controls on the page - Specified at site or folder level using
Web.config to affect allpages within scope - Programmable at run time to offer enhanced
customization and personalization capabilities
11Membership 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
12ASP.NET Web Site Administration Tool
13Lab 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
14Lab 5B Programming Master Pages, Site
Navigation, and Themes
- Exercise 1 Creating Master andContent Pages
- Exercise 2 Creating DepartmentalMaster Pages
- Exercise 3 Implementing Site Navigation
- Exercise 4 Implementing Themesand Skins
15Lab 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