1 Rajath Nigam Presentation ID 19 10122017 A

  • Slides: 28
Download presentation
1 Rajath Nigam | Presentation ID – 19 | 10/12/2017

1 Rajath Nigam | Presentation ID – 19 | 10/12/2017

§ A brief introduction. . § Web. Sitemap file. . § A few controls.

§ A brief introduction. . § Web. Sitemap file. . § A few controls. . § ASP. NET routing. . 2

§ The navigation features are created to simplify the task of creating menus for

§ The navigation features are created to simplify the task of creating menus for everything, or simply to help the users find the ‘right way’ for everything in your website! § To implement these features, ASP. NET provides a site map data source control, and three navigation controls. Rajath Nigam | Presentation ID – 19 | 10/12/2017 3

§ Hover the mouse over a control to view its sub-controls. . § Site.

§ Hover the mouse over a control to view its sub-controls. . § Site. Map. Path control displays a list of all the links leading from the website’s homepage to the current page. This makes it easy for the user to navigate between home page and current page. § These links are sometimes referred to as bread crumbs. Rajath Nigam | Presentation ID – 19 | 10/12/2017 4

§ The Tree. View control displays the pages of a website in a tree

§ The Tree. View control displays the pages of a website in a tree structure. § This is similar to a directory tree we have in the Windows Explorer. § The user can choose to expand or collapse a node by clicking on the icon that appears next to each node that has children. Rajath Nigam | Presentation ID – 19 | 10/12/2017 5

§ The Tree. View and Menu controls are used with Site. Map. Data. Source

§ The Tree. View and Menu controls are used with Site. Map. Data. Source control. § This binds the controls to a file named web. sitemap. § This file contains the XML that defines the structure of pages that make up the website. Rajath Nigam | Presentation ID – 19 | 10/12/2017 6

Rajath Nigam | Presentation ID – 19 | 10/12/2017 7

Rajath Nigam | Presentation ID – 19 | 10/12/2017 7

Rajath Nigam | Presentation ID – 19 | 10/12/2017 8

Rajath Nigam | Presentation ID – 19 | 10/12/2017 8

§ This file is to be created in the application’s root directory. § This

§ This file is to be created in the application’s root directory. § This file contains XML that defines the hierarchical structure of the pages that make up the application. § To add an existing web. sitemap file to an application, enter the WEBSITE -> Add new Item command then select Site Map option from the list of templates. § You can use a text editor to edit the contents of this file. Rajath Nigam | Presentation ID – 19 | 10/12/2017 9

§ There are two elements of web. sitemap file, sitemap and site. Map. Node.

§ There are two elements of web. sitemap file, sitemap and site. Map. Node. § sitemap is the root element for the XML file and should appear only once in the document. § However, site. Map. Node element has to be created for every page on which we intend to use the navigation controls. § In this element, we specify the URL of the page, the title of the page, the map path, or tree and a description of the page. Rajath Nigam | Presentation ID – 19 | 10/12/2017 10

Rajath Nigam | Presentation ID – 19 | 10/12/2017 11

Rajath Nigam | Presentation ID – 19 | 10/12/2017 11

Rajath Nigam | Presentation ID – 19 | 10/12/2017 12

Rajath Nigam | Presentation ID – 19 | 10/12/2017 12

§ One way to create a site. Map. Data. Source control is to simply

§ One way to create a site. Map. Data. Source control is to simply drag and drop this control from the toolbox. § Another way is to click the smart tag for a Tree. View or Menu control, and choose New Data Source from the menu that appears. § A new window appears and then we can select Site Map and click OK to create a new site map data source. § To customize behavior, attributes can be used which are listed in there. Rajath Nigam | Presentation ID – 19 | 10/12/2017 13

Rajath Nigam | Presentation ID – 19 | 10/12/2017 14

Rajath Nigam | Presentation ID – 19 | 10/12/2017 14

Rajath Nigam | Presentation ID – 19 | 10/12/2017 15

Rajath Nigam | Presentation ID – 19 | 10/12/2017 15

§ Lets you create menus that are aligned horizontally or vertically. § Vertical menus

§ Lets you create menus that are aligned horizontally or vertically. § Vertical menus appear as sidebars whereas horizontal menus appear below the header and above the sidebar. § Items in the menu may contain sub-menus which appear when we hover the mouse over them. These kind of menus are called dynamic menus. § The menu that’s displayed openly always is called as a static menu. Rajath Nigam | Presentation ID – 19 | 10/12/2017 16

Rajath Nigam | Presentation ID – 19 | 10/12/2017 17

Rajath Nigam | Presentation ID – 19 | 10/12/2017 17

§ Must be bound to a site map data source. § The most frequently

§ Must be bound to a site map data source. § The most frequently used attribute associated with this control is the Data. Source. ID, which specifies the ID of the data source that provides the site map data. § There are many other attributes that let you customize the appearance & behavior of the Tree. View control. For instance, Expand. Depth is an attribute that sets the number of levels that are expanded when the Tree. View is first displayed. Rajath Nigam | Presentation ID – 19 | 10/12/2017 18

Rajath Nigam | Presentation ID – 19 | 10/12/2017 19

Rajath Nigam | Presentation ID – 19 | 10/12/2017 19

§ Unlike the Tree. View and the Menu controls, this doesn’t have to be

§ Unlike the Tree. View and the Menu controls, this doesn’t have to be bound with a data source. § It gets the navigation information directly from the web. sitemap file. § The attributes listed in this let you customize the appearance of the Site. Map. Path control. § We can specify the number of parent nodes, the direction in which they are listed, text separator for the nodes etc. Rajath Nigam | Presentation ID – 19 | 10/12/2017 20

Rajath Nigam | Presentation ID – 19 | 10/12/2017 21

Rajath Nigam | Presentation ID – 19 | 10/12/2017 21

§ A URL contains various parts, like the protocol, domain, path and file name.

§ A URL contains various parts, like the protocol, domain, path and file name. § One way to exchange data between pages is to use query strings encoded at the end of URL. § In ASP. NET routing, the data exchanged between pages becomes a part of friendly URL. § One of the main benefits of this is what we usually call, the Search Engine Optimization. § The optimization occurs when all webpages with friendly URL’s are archived by the search engines. Rajath Nigam | Presentation ID – 19 | 10/12/2017 22

§ For example, a friendly URL is this: § www. halloweenstore. com/Order. aspx? Productid=shankard

§ For example, a friendly URL is this: § www. halloweenstore. com/Order. aspx? Productid=shankard adambbs § However, most search engines will archive this as: § www. halloweenstore. com/Order. aspx § This would shorten the search, and hence archive the URL. This would enable the optimization. Also, they are easier to read and remember. Rajath Nigam | Presentation ID – 19 | 10/12/2017 23

Rajath Nigam | Presentation ID – 19 | 10/12/2017 24

Rajath Nigam | Presentation ID – 19 | 10/12/2017 24

§ The basic idea that makes friendly URLs possible in ASP. NET is the

§ The basic idea that makes friendly URLs possible in ASP. NET is the routing framework. § In order to use the routing framework, we must first map all the application’s routes. § A route is a URL pattern that identifies a page, and can either be static or dynamic. § A static route will always be the same, whereas a dynamic one will have at least one placeholder in it which causes it to change. Rajath Nigam | Presentation ID – 19 | 10/12/2017 25

Rajath Nigam | Presentation ID – 19 | 10/12/2017 26

Rajath Nigam | Presentation ID – 19 | 10/12/2017 26

Rajath Nigam | Presentation ID – 19 | 10/12/2017 27

Rajath Nigam | Presentation ID – 19 | 10/12/2017 27

28

28