Export (0) Print
Expand All

HierarchicalDataSourceControl.GetHierarchicalView Method

Gets the view helper object for the IHierarchicalDataSource interface for the specified path.

Namespace:  System.Web.UI
Assembly:  System.Web (in System.Web.dll)

'Declaration
Protected MustOverride Function GetHierarchicalView ( _
	viewPath As String _
) As HierarchicalDataSourceView

Parameters

viewPath
Type: System.String

The hierarchical path of the view to retrieve.

Return Value

Type: System.Web.UI.HierarchicalDataSourceView
A HierarchicalDataSourceView that represents a single view of the data at the hierarchical level identified by the viewPath parameter.

This GetHierarchicalView method provides the default implementation for the HierarchicalDataSourceControl class, which simply returns Nothing. Classes that derive from the HierarchicalDataSourceControl class override this method and provide an implementation to return a strongly typed view that derives from HierarchicalDataSourceView.

The following code example demonstrates how to override the GetHierarchicalView method in a class that extends the HierarchicalDataSourceControl class to return a strongly typed HierarchicalDataSourceView object. This code example is part of a larger example provided for the HierarchicalDataSourceControl class.

Imports System
Imports System.Collections
Imports System.IO
Imports System.Runtime.InteropServices
Imports System.Security.Permissions
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls

Namespace Samples.AspNet

    Public Class FileSystemDataSource
        Inherits HierarchicalDataSourceControl

        Public Sub New()
        End Sub 

        Private view As FileSystemDataSourceView = Nothing 

        Protected Overrides Function GetHierarchicalView( _
            ByVal viewPath As String) As HierarchicalDataSourceView

            view = New FileSystemDataSourceView(viewPath)
            Return view
        End Function 

    End Class

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft