ערוך

שתף באמצעות


IDataSource.GetView(String) Method

Definition

Gets the named data source view associated with the data source control.

public:
 System::Web::UI::DataSourceView ^ GetView(System::String ^ viewName);
public System.Web.UI.DataSourceView GetView (string viewName);
abstract member GetView : string -> System.Web.UI.DataSourceView
Public Function GetView (viewName As String) As DataSourceView

Parameters

viewName
String

The name of the view to retrieve.

Returns

Returns the named DataSourceView associated with the IDataSource.

Examples

The following code example demonstrates how a data source control class that implements the IDataSource interface implements the GetView method, returning a strongly typed instance of the DataSourceView class. Because the data source control supports only one view, it ignores the name and returns a view named with the default view name. This code example is part of a larger example provided for the DataSourceControl class.

// Return a strongly typed view for the current data source control.
private CsvDataSourceView view = null;
protected override DataSourceView GetView(string viewName) {
    if (null == view) {
        view = new CsvDataSourceView(this, String.Empty);
    }
    return view;
}
' Return a strongly typed view for the current data source control.
Private view As CsvDataSourceView = Nothing

Protected Overrides Function GetView(viewName As String) As DataSourceView
   If view Is Nothing Then
      view = New CsvDataSourceView(Me, String.Empty)
   End If
   Return view
End Function 'GetView

Remarks

Data source control classes can support one or more views on their underlying data. These views are represented by instances of the DataSourceView class. The data source view defines the capabilities of a data source control, and performs all the work necessary to retrieve data from the underlying data store and perform operations such as sorting, inserting, deleting, and updating.

Data source control classes that implement the IDataSource interface implement the GetView method to return strongly typed view objects associated with the class.

Applies to

See also