Site map - Design and development of web-applications

Site Map

In the event that the web application contains a large number of web forms, it is advisable to use the site map. A site map is a convenient way to describe the structure of a web application, and also allows it to be displayed to users using several controls. These controls are located in the Navigation section of the Toolbox. The main controls that provide the ability to display the site map are SiteMapPath, Menu and TreeView. All of these elements are designed to solve the same problem - allowing the user of a web application to navigate web forms. The difference between them lies in the way the links to the corresponding forms are displayed.

To use any of the listed components, you need to define the structure of the application that is stored separately.

The XML file is usually used as a structure store. In Visual Studio, there is already a specific structure of the XML file intended for storing the application structure, these are files of type .sitemap. The content of this file is quite simple, which makes it easy to enter data about the structure of the application. Separation of elements responsible for displaying data and elements containing this data makes it much easier to edit the application; to change the design it is enough to change the settings of visual components, to add additions - add data to the XML file.

Let's consider an example of adding navigation on pages of a web application using a site map. First of all, you need to add the XML file and describe the data about the application structure in it.

To add an XML file, you can use the standard Website => Add New Item command. In the window that opens, select the file type "Site Mar". As a result, a Web.sitemap file will be created that contains the blanks for entering the structure of the web application:

& lt;? xml version = 1.0 encoding = '' utf-8 ''? & gt;

& lt; siteMap xmlns =" & gt;

& lt; siteMapNode url = title = description = '"' & gt;

& lt; siteMapNode url = title = description ^ '/& gt;

& lt; siteMapNode url-title = '' description ^ '/& gt;

& lt;/siteMapNode & gt;

& lt;/siteMap & gt;

As you can see from the source code, the site map begins with the root node & lt; siteMap & gt ;. Elements of the structure are described in the & lt; siteMapNode & gt; tags. Using these tags, you can specify the hierarchy of the elements of the web application. To specify the nested elements, they simply need to be placed inside the appropriate & lt; siteMapNode & gt; tag. The properties of each tag are required to specify the corresponding values. From the example above it is clear that each element has three properties: url, title, description. Their purpose is obvious: the url is used to specify the URL of the page to which this element matches; title specifies the name of the item displayed by the control; description - description of the element that is displayed as a tooltip when the mouse pointer is over the corresponding element.

As an example of a simple site map, we will create a page hierarchy consisting of six elements. The topmost element of the hierarchy is the home page that references the Default.aspx file. All other elements will be enclosed in it. In addition, in the


Page 4 two more elements must be enclosed. An example of a site map describing this structure is shown below:

& lt;? xml version- 1.0 encoding-'utf-8 "? & gt;

& lt; siteMap xmlns = "" & gt;

& lt; siteMapNode url = Default.aspx title = Home description = " & gt;

& lt; siteMapNode url = Page2.aspx '' title-'Page 2 description = Go to page 2 /& gt;

& lt; siteMapNode url = Page3.aspx title-'Page 3 description = /& gt;

& lt; siteMapNode url = Page4.aspx '' title-'Page 4 "& gt;

& lt; siteMapNode url = '' Page5.aspx '' title-'Page 57 & gt;

thematic pictures

Also We Can Offer!

Ошибка в функции вывода объектов.