Chapter 7 Navigation. Objectives How to move around in your site using server controls and plain HTML How to address pages and other resources like images.

Slides:



Advertisements
Similar presentations
© 2011 Delmar, Cengage Learning Chapter 1 Getting Started with Dreamweaver.
Advertisements

Master Pages, User Controls, Site Maps, Localization Svetlin Nakov Telerik Corporation
4.01 How Web Pages Work.
© 2010 Delmar, Cengage Learning Chapter 1 Getting Started with Dreamweaver.
1 Chapter 12 Working With Access 2000 on the Internet.
Chapter 1 Getting Started With Dreamweaver. Explore the Dreamweaver Workspace The Dreamweaver workspace is where you can find all the tools to create.
Topics in this presentation: The Web and how it works Difference between Web pages and web sites Web browsers and Web servers HTML purpose and structure.
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
Getting Started with Dreamweaver
1 Designing & Developing Web- Based Solutions in ASP.NET Week 3 Website Navigation & Resources.
Web Site Navigation How to get around in an ASP.NET web application 1Web Site Navigation.
Introduction to.Net and ASP.Net Course Introduction Build Your Own ASP.Net Website: Chapter 1 Microsoft ASP.Net Walkthrough: Creating a Basic Web Forms.
Tutorial: Introduction to ASP.NET Internet Technologies and Web Application 4 th February 2010.
1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
© 2008 Dr. Paul Walcott – The University of the West Indies: Cave Hill CampusDr. Paul Walcott COMP6325 Advanced Web Technologies Dr. Paul Walcott The University.
Beginning Web Site Development Module 1 – Dynamic Web Site Development Fundamentals of building dynamic Web sites with ASP.NET 2.0 and C# Version.
Chapter 6 The World Wide Web. Web Pages Each page is an interactive multimedia publication It can include: text, graphics, music and videos Pages are.
Mohammed Mohsen Links Links are what make the World Wide Web web-like one document on the Web can link to several other documents, and those.
XHTML Introductory1 Linking and Publishing Basic Web Pages Chapter 3.
XP New Perspectives on Browser and Basics Tutorial 1 1 Browser and Basics Tutorial 1.
5 Chapter Five Web Servers. 5 Chapter Objectives Learn about the Microsoft Personal Web Server Software Learn how to improve Web site performance Learn.
E-Commerce: Introduction to Web Development 1 Dr. Lawrence West, Management Dept., University of Central Florida Topics What is a Web.
Web Programming: Client/Server Applications Server sends the web pages to the client. –built into Visual Studio for development purposes Client displays.
CHAPTER 3 USING HYPERLINKS TO CONNECT CONTENT. LEARNING OBJECTIVES How to use the and anchor tag pair to create a text-based hyperlink. How to use the.
Database-Driven Web Sites, Second Edition1 Chapter 5 WEB SERVERS.
Macromedia Dreamweaver 8 Revealed DREAMWEAVER GETTING STARTED WITH.
Internet Technologies and Web Application Web Services With ASP.NET Tutorial: Introduction to.
1.  Use the anchor element to link from page to page  Configure absolute, relative, and hyperlinks  Configure relative hyperlinks to web pages.
Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 1.
Chapter 7 – Navigation Dr. Stephanos Mavromoustakos.
Joe Hummel, PhD Dept of Mathematics and Computer Science Lake Forest College
Module: Software Engineering of Web Applications Chapter 2: Technologies 1.
Marco Bellinaso Senior Trainer & Consultant Code Architects Srl Building Dynamic Navigation Systems with Visual Studio 2005 and ASP.NET 2.0.
Introduction  “M” “V” “C” stands for “MODEL” “VIEW” “CONTROLLER”. ASP.NET MVC is an architecture to develop ASP.NET web applications in a different manner.
© ExplorNet’s Centers for Quality Teaching and Learning 1 Objective % Understand advanced production methods for web-based digital media.
11 User Controls Beginning ASP.NET in C# and VB Chapter 8.
Easy Site Navigation Getting organized, staying organized Creating custom site-navigation controls Using Menu, TreeView, and SiteMenuPath controls Make.
Chapter 2 Creating Website with Web Forms. Objectives Understand the different project types and templates when building ASP.NET web sites. The different.
HTML5 and CSS3 Illustrated Unit E: Inserting and Working with Links.
Finally getting to html and CSS… Tim Berners-Lee, the writer of the software program that makes him the inventor of the WWW, defines the Internet as a.
Chapter 1 Getting Started with ASP.NET Objectives Why ASP? To get familiar with our IDE (Integrated Development Environment ), Visual Studio. Understand.
4.01 How Web Pages Work.
Getting Started with Dreamweaver
4.01 How Web Pages Work.
Site Maps and Navigation
4.01 How Web Pages Work.
Computing with C# and the .NET Framework
Objective % Select and utilize tools to design and develop websites.
ASP.NET Web Controls.
CISC103 Web Development Basics: Web site:
Exploring Microsoft Word 2000
Chapter 8 User Controls.
Chapter A - Getting Started with Dreamweaver MX 2004
Learning the Basics – Lesson 1
Website Navigation.
Web software.
Objective % Select and utilize tools to design and develop websites.
Getting Started with Dreamweaver
State management & Master Pages in asp.net
CS 3870/CS 5870 Prog 6 Site Map.
Getting Started with Dreamweaver
Static and Dynamic Web Pages
Building ASP.NET Applications
Document Structure & HTML
NAVIGATION CONTROLS.
4.01 How Web Pages Work.
Client-Server Model: Requesting a Web Page
4.01 How Web Pages Work.
Website Navigation.
Presentation transcript:

Chapter 7 Navigation

Objectives How to move around in your site using server controls and plain HTML How to address pages and other resources like images How to use the ASP.NET Menu, TreeView, and SiteMapPath navigation controls How to use ASP.NET’s routing capabilities How to send users from one page to another programmatically

Moving around your site You can link through a regular HTML anchor You can log in here You can link through a server side Hyperlink control which renders as an HTML anchor You can log in here Renders as You can log in here

Relative URL URL stands for Uniform Resource Locator and is used to access another web resource. Relative URL: Points to another resource based on the location of the current resource If some was to ask you how to get to FIU, you could ask them where they are and then give them directions based on their location. If they were to change location, you would have to give them different directions. Relative URL looks at the current folder structure, and you can go to the parent folder by using “../”

Relative URL Starting at the root of the site. To link from Login.aspx at the root to Default.aspx, under the management folder Management To refer to the image Header.jpg from Default.aspx in the management folder You can also use multiple “../” together to go up multiple folders For example “../../Images/Header.jpg” would work from the Reviews folder

Root-Based Relative URLs You can use a “/” to start from the root of the website structure Management This works regardless of where the URL call is made, because it starts at the root and finds the resource in the structure. Server-Side Relative URLs: You can use the ~ to point to the root on the website If an application folder is configured on the web server, the ~ will navigate the application folder instead of the usual root

Absolute URL The URL is using the full domain name and protocol Required for resources outside your website When possible, use relative URLs If website is move to a new domain Absolute URLs will break Carries more overhead than the same file using a relative path.

Default documents Files can be configured to be the default file that gets accessed in the web server if a call to is called. If the web server is configured to use default.aspx as the default document, then: will automatically go to If there is a default document, you should use the domain in a link instead of domain/defaultdocument

Navigation Controls: Menu, Treeview, SiteMapPath

Navigation Controls Web.sitemap is an XML file which is used as the configuration for the navigation controls and contains the logical structure of the site. <siteMapNode url="~/Reviews.aspx" title="Reviews" description="Reviews published on this site" /> <siteMapNode url="~/About.aspx" title="About" description="About this site" /> siteMap is the top root and only one siteMapNode is allowed under sitemap (the Home page). Can work with Security to show / hide.

Menu Control You can add a menu control and configure its SiteMapDataSource to point to the configured site map and it will be ready to use. There are many properties for this control…you can control its styling through CSS class RenderingMode can be switched between heavier tables with inline styles and more lightweight unordered lists. You can design the control through the properties which will add it to a tag. Or you can use a.css file to change the design of the elements in the menu (level1, level2 which are CSS classes).

CSS in for the menu control Menu rendered can be styled with CSS Home <a title="Reviews published on this site" Class="level1" href="/Reviews/Default.aspx">Reviews <a title="All Reviews Grouped by Genre" class="level2" href="/Reviews/AllByGenre.aspx">By Genre <a title="All Reviews" class="level2" href="/Reviews/All.aspx">All Reviews... a.level1:hover, a.level2:hover { background-color: #BCD1FE; }

Treeview control Hierarchical and collapsible structure, like Windows Explorer Can use other XML files instead of the SiteMap Uses the SiteMapDataSource to bind to a menu data file. You can hide the -, + images which affect the collapse and expand of the nodes. Rendering generates table HTML with a lot of overhead

SiteMapPath Often referred as a breadcrumb, a series or of links usually with a parent-> children relationship. Usually has a separate between the links SiteMapPath helps users understand where they are in the site and gives them an easy way to navigate to pages higher up in the site hierarchy. Renders as a series of tags

Routing FriendlyURL routing can be configured to drop the.aspx extension on a URL call, so accessing /Contact would redirect to /Contact.aspx Must install a new package from NuGet package manager A Configuration class is created under App_Code folder The Global.asax file must be modified. Global.asax is a special file at the root of your website in which we can program to respond to global events on your site. These global events include (Application_Init, Application_Start, Application_Error, BeginRequest and others ).

Routing In the package manager command prompt, install: Install-Package Microsoft.AspNet.FriendlyUrls.Core Create a class called RouteConfig in the App_Code using System.Web.Routing; using Microsoft.AspNet.FriendlyUrls; public static class RouteConfig { public static void RegisterRoutes(RouteCollection routes) { var settings = new FriendlyUrlSettings(); settings.AutoRedirectMode = RedirectMode.Permanent; routes.EnableFriendlyUrls(settings); }

Routing In the Global.asax file, add the following code under Application_Start void Application_Start(object sender, EventArgs e) { // Code that runs on application startup RouteConfig.RegisterRoutes(System.Web.Routing.RouteTable.Routes); } The requests to the different pages will no longer have the extension showing (.aspx)

Programmatic Redirection: Redirect In ASPX, Response object gives you access to useful properties and methods that are all related to the response from the server to the user’s browser. Response.Redirect is a method on the server side which instructs the client browser to go to another page, so control goes from the redirect (server side) -> browser (client) -> new request to new resource (another server). Response.RedirectPermanent works with search engines to keep note of the redirect as a permanent one and stop requesting the current file. protected void Page_Load(object sender, EventArgs e) { Response.RedirectPermanent("Default"); }

Programmatic Redirection: Redirect Often we want to redirect with the querystring, a key, value pair of paremeters which are passed by the URL call. The Redirect in the “FROM” page: protected void Page_Load(object sender, EventArgs e) { Response.Redirect("Target?Test=SomeValue"); } The Request in the “TO” page: protected void Page_Load(object sender, EventArgs e) { Label1.Text = Request.QueryString.ToString(); }

Server Side Transfer Uses the.NET Server Object. Never returns control back to the user’s browser and hence doesn’t show the URL that it is being transferred to in the browser. For example, a user may request a page like this: Under the hood the server might transfer to: 345

Server Side Transfer Use the Server.Transfer() method. Can only transfer to pages within your website. ASP.NET will throw an error if you try to transfer to a page outside of your domain. Pass it resource or page to load and it will do so right away. protected void Page_Load(object sender, EventArgs e) { Server.Transfer("Target.aspx?Test=SomeValue"); }

Try it Out Pg. 248 Pg. 255 Pg. 259 Pg. 261 Pg. 265 Pg. 267

Summary In this chapter we covered: Learned how to move around in your site using server controls and plain HTML Learned how to link pages and other resources like images Learned How to use the ASP.NET Menu, TreeView, and SiteMapPath navigation controls Understood how to use ASP.NET’s routing capabilities Learned to send users from one page to another programmatically