1 designing & developing web- based solutions in asp.net week 3 website navigation &...

15
1 Designing & Developing Web- Based Solutions in ASP.NET Week 3 Website Navigation & Resources

Upload: catherine-garrison

Post on 25-Dec-2015

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1 Designing & Developing Web- Based Solutions in ASP.NET Week 3 Website Navigation & Resources

1

Designing & Developing Web-Based Solutions in ASP.NET

Week 3

Website Navigation &

Resources

Page 2: 1 Designing & Developing Web- Based Solutions in ASP.NET Week 3 Website Navigation & Resources

Today’s Agenda

Web Site Navigation MultiView-Wizard SiteMaps TreeView-Menu Controls SiteMapPath Control

Resources Text Localization Graphic & Other Asset Localization

Lab: Finish MasterPage & Populate Site with pages Website Navigation Localized Text Strings

Designing & Developing Web-Based Solutions in ASP.NET 2

Page 3: 1 Designing & Developing Web- Based Solutions in ASP.NET Week 3 Website Navigation & Resources

MultiView & Wizard Controls

Purpose Single web page -- Multiple views

Lists (www.vistaprint.com) Surveys Alternate views of data (Raw text, chart, image, …)

Good Single page keeps navigation simple

Bad Data / State can make for large page if sloppy.

Designing & Developing Web-Based Solutions in ASP.NET 3

Page 4: 1 Designing & Developing Web- Based Solutions in ASP.NET Week 3 Website Navigation & Resources

MultiView vs. Wizard

Wizard has more features State restrictions Extra navigation controls Submit control

Submit each step

OR Submit on final

Designing & Developing Web-Based Solutions in ASP.NET 4

Page 5: 1 Designing & Developing Web- Based Solutions in ASP.NET Week 3 Website Navigation & Resources

Site Maps

Purpose Define page Heirarchy Define page URL, Friendly Name, Tooltip Description Use in a Navigation control

Types Files: <somename>.sitemap Code/DB: via SiteMapProvider

Designing & Developing Web-Based Solutions in ASP.NET 5

Page 6: 1 Designing & Developing Web- Based Solutions in ASP.NET Week 3 Website Navigation & Resources

Default.sitemap file

<?xml version="1.0" encoding="utf-8" ?> <siteMap

xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" > <siteMapNode url="Default.aspx" title=“Home"

description="Home page"> <siteMapNode url="About.aspx" title="About"

description="Company History" /> </siteMapNode>

</siteMap>

Designing & Developing Web-Based Solutions in ASP.NET 6

Page 7: 1 Designing & Developing Web- Based Solutions in ASP.NET Week 3 Website Navigation & Resources

Nested Site Map files

<siteMap> <siteMapNode title=“Home” url=“~/”>

<siteMapNode siteMapFile=“~/Visitor.sitemap” /> <siteMapNode siteMapFile=“~/Admin.sitemap” />

</siteMapNode> </siteMap>

Can restrict menu display to child sitemaps

Designing & Developing Web-Based Solutions in ASP.NET 7

Page 8: 1 Designing & Developing Web- Based Solutions in ASP.NET Week 3 Website Navigation & Resources

Site Map Restrictions

URL’s must be unique Work Arounds

Use a custom SiteMapProvider (more work) Add dummy query strings to identical URLs (BEST)

URL=“~\About.aspx?id=1” URL=“~\About.aspx?id=2”

URL Mapping: Alias URLs in web.config <configuration><system.web>

<urlMappings enabled=“true”> <add url=“~/About.aspx?id=1” mappedUrl=“~\About.aspx”/>

NOTE: stops the bogus query string from appearing

Designing & Developing Web-Based Solutions in ASP.NET 8

Page 9: 1 Designing & Developing Web- Based Solutions in ASP.NET Week 3 Website Navigation & Resources

Security Trimming

Auto enable/disable private pages in .sitemap web.config

<configuration><system.web> <siteMap defaultProvider=“SecureSiteMapProvider”>

<add name=“SecureSiteMapProvider” siteMapFile=“Default.sitemap” securityTrimmingEnabled=“true”/>

Turn OFF security Default.sitemap

<SiteMapNode title=“Admin” … roles=“*”/> // All allowed

Designing & Developing Web-Based Solutions in ASP.NET 9

Page 10: 1 Designing & Developing Web- Based Solutions in ASP.NET Week 3 Website Navigation & Resources

SiteMapDataSource

Provides the link: References a .sitemap Hooked to one or more Navigation controllers

Control Hierarchy Visibility SiteMapDataSource.ShowStartingNode SiteMapDataSource.StartFromCurrentNode SiteMapDataSource.StartingNodeOffset

Designing & Developing Web-Based Solutions in ASP.NET 10

Page 11: 1 Designing & Developing Web- Based Solutions in ASP.NET Week 3 Website Navigation & Resources

Menu &/|| Treeview

Both highly configurable Orientation: horizontal/vertical Colors, images, fonts Dummy vs. clickable nodes Spacing Styles for different levels of the hierarchy

Add the SiteMapDataSource to the property Can have multiple menus & SiteMapDataSrc’s

Designing & Developing Web-Based Solutions in ASP.NET 11

Page 12: 1 Designing & Developing Web- Based Solutions in ASP.NET Week 3 Website Navigation & Resources

SiteMapPath

Purpose: Displays the current pages hierarchy.

“You are HERE” Can allow user to select a parent page

Can set styles, clickable links, tooltips, … Home > About > Contact Us > Directions

ParentLevelsDisplayed = 1 Contact Us > Directions

Does NOT use siteMapDataSource.

Designing & Developing Web-Based Solutions in ASP.NET 12

Page 13: 1 Designing & Developing Web- Based Solutions in ASP.NET Week 3 Website Navigation & Resources

Localization – Resource files

App_LocalResources Page Specific

About.aspx About.aspx.resx About.aspx About.aspx.fr.resx About.aspx About.aspx.sp.resx

App_GlobalResources Site wide

Resources.resx

Content ID=Text

Designing & Developing Web-Based Solutions in ASP.NET 13

Page 14: 1 Designing & Developing Web- Based Solutions in ASP.NET Week 3 Website Navigation & Resources

Localization - Code

String.Format() // localized by default “0:c” // currency Additional special symbols localized (date/time,…)

DateTime.ToString() // localized by default

Designing & Developing Web-Based Solutions in ASP.NET 14

Page 15: 1 Designing & Developing Web- Based Solutions in ASP.NET Week 3 Website Navigation & Resources

Homework

Readings Chapter 15 – User Controls

Project Menu, BreadCrumb, Localization, Wizard…

Designing & Developing Web-Based Solutions in ASP.NET 15