Прочитај на енглеском Уреди

Делите путем


HierarchicalDataSourceControl.GetHierarchicalView(String) Method

Definition

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

C#
protected abstract System.Web.UI.HierarchicalDataSourceView GetHierarchicalView(string viewPath);

Parameters

viewPath
String

The hierarchical path of the view to retrieve.

Returns

A HierarchicalDataSourceView that represents a single view of the data at the hierarchical level identified by the viewPath parameter.

Examples

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.

C#
using System;
using System.Collections;
using System.IO;
using System.Runtime.InteropServices;
using System.Security.Permissions;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public class FileSystemDataSource :
    HierarchicalDataSourceControl, IHierarchicalDataSource
{
    private FileSystemDataSourceView view = null;

    public FileSystemDataSource() : base() { }

    protected override HierarchicalDataSourceView
        GetHierarchicalView(string viewPath)
    {
        view = new FileSystemDataSourceView(viewPath);
        return view;
    }
}

Remarks

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

Applies to

Производ Верзије
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

See also