Este artigo foi traduzido por máquina. Para visualizar o arquivo em inglês, marque a caixa de seleção Inglês. Você também pode exibir o texto Em inglês em uma janela pop-up, movendo o ponteiro do mouse sobre o texto.
Tradução
Inglês

SiteMapDataSource Classe

Fornece um controle de fonte de dados, que controles web e outros tipos de controles possam usar para fazer uma ligação a dados hierárquicos de site map.

Namespace:  System.Web.UI.WebControls
Assembly:  System.Web (em System.Web. dll)

[ToolboxBitmapAttribute(typeof(SiteMapDataSource))]
[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public class SiteMapDataSource : HierarchicalDataSourceControl, IDataSource, 
	IListSource

The SiteMapDataSource control is a data source to the site map data that is stored by the site map providers that are configured for your site.The SiteMapDataSource enables Web server controls that are not specifically site navigation controls, such as the TreeView, Menu, and DropDownList controls, to bind to hierarchical site map data.Você pode usar esses controles servidor Web para exibir um mapa (n.); mapear (v.) site como um Tabela de conteúdo ou para ativamente navegar um site.Alternatively, you can use the SiteMapPath control, which is designed specifically as a site navigation control and therefore does not need an instance of the SiteMapDataSource control.

Observação:

Se você não estiver familiarizado com os recursos de acesso de dados do ASP.NET 2.0, você pode ser útil para examinar os tópicos a seguir antes de continuar:

The SiteMapDataSource binds to site map data and presents its view based on a specified starting node in the site map hierarchy.Por padrão, ele é o nó de raiz da hierarquia mas ele também pode ser qualquer nó dentro da hierarquia.The starting node is identified by the values of several SiteMapDataSource properties as follows:

Iniciando nó

Valores das Propriedade

O nó de raiz da hierarquia (a configuração padrão).

The StartFromCurrentNode is false.

The StartingNodeUrl is not set.

O nó que representa a página atualmente exibida.

The StartFromCurrentNode is true.

The StartingNodeUrl is not set.

Um nó específico da hierarquia.

The StartFromCurrentNode is false.

The StartingNodeUrl is set.

If the StartingNodeOffset property is set to a value other than 0, it affects the starting node and with it the site map data hierarchy that is exposed by the SiteMapDataSource control.The negative or positive integer value of the StartingNodeOffset identifies the number of levels up or down the site map hierarchy from the starting node that is identified by the StartFromCurrentNode and StartingNodeUrl properties to offset the starting node of the subtree that is exposed by data source control.

If the StartingNodeOffset property is set to a negative number -n, the starting node of the subtree that is exposed by the data source control is the ancestor node n hierarchical levels above the identified starting node.If the value n is greater than the number of ancestor levels in the hierarchical tree, the starting node of the subtree is the root node of the site map hierarchy.

If the StartingNodeOffset property is set to a positive number +n, the starting node of the subtree that is exposed is a child node n levels below the identified starting node.Because more than one branch of child nodes might exist in the hierarchy, the SiteMapDataSource attempts to resolve a child node directly on the path between the identified starting node and the node that represents the currently requested page, if possible.If the node that represents the currently requested page is not in the subtree of the identified starting node, the value of the StartingNodeOffset property is ignored.If the node that represents the currently requested page is less than n levels below the identified starting node, the currently requested page node is used as the starting node.

Site map data is retrieved from an SiteMapProvider object, such as XmlSiteMapProvider, which is the default site map provider for ASP.NET.You can specify any provider that is configured for your site to provide the site map data to the SiteMapDataSource and can obtain the list of available providers by accessing the SiteMap.Providers collection.

Like all data source controls, every instance of a SiteMapDataSource is associated with a single helper object, known as a data source view.The SiteMapDataSourceView is a view on the site map data, according to the properties of the data source, and is retrieved by calling the GetHierarchicalView method.The SiteMapDataSourceView maintains the SiteMapNodeCollection object that the controls bind to.

Por padrão, o nó inicial é o nó de raiz da hierarquia, mas você pode definir o nó inicial para qualquer nó.O ponto de partida pode ser um nó que é relativo à posição atual no mapa de sites ou para uma posição absoluta.You can specify the starting node by setting the StartingNodeUrl property.

The SiteMapDataSource is specialized for navigation data, and does not support common data source operations such as sorting, filtering, paging, caching, or data record operations such as updates, insertions or deletions.

The following code example demonstrates how to declaratively bind a TreeView control to a site map using a SiteMapDataSource control.Os dados de mapa de site são recuperados começando o nível de nó de raiz.

<%@ Page Language= %>
<!DOCTYPE html PUBLIC "-

<html xmlns="http:
    <head runat=>
    <title>ASP.NET Example</title>
</head>
<body>
        <form id= runat=>
            <asp:SiteMapDataSource
                id=
                runat= />

            <asp:TreeView
                id=
                runat=
                DataSourceID=>
            </asp:TreeView>

        </form>
    </body>
</html>


<%@ Page Language="VJ#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
        <form id="form1" runat="server">
            <asp:SiteMapDataSource
                id="SiteMapDataSource1"
                runat="server">
            </asp:SiteMapDataSource>

            <asp:TreeView
                id="TreeView1"
                runat="server"
                DataSourceID="SiteMapDataSource1">
            </asp:TreeView>

        </form>
    </body>
</html>


System.Object
  System.Web.UI.Control
    System.Web.UI.HierarchicalDataSourceControl
      System.Web.UI.WebControls.SiteMapDataSource

Quaisquer membros públicos estático (compartilhados na Visual Basic) desse tipo são Thread seguro. Não há garantia de que qualquer membro de instância seja isento de segmentos.

Contribuições da comunidade

ADICIONAR
Mostrar: