Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
 GetView Method
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework Class Library
IDataSource..::.GetView Method

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

Namespace:  System.Web.UI
Assembly:  System.Web (in System.Web.dll)
Visual Basic (Declaration)
Function GetView ( _
    viewName As String _
) As DataSourceView
Visual Basic (Usage)
Dim instance As IDataSource
Dim viewName As String
Dim returnValue As DataSourceView

returnValue = instance.GetView(viewName)
C#
DataSourceView GetView(
    string viewName
)
Visual C++
DataSourceView^ GetView(
    String^ viewName
)
JScript
function GetView(
    viewName : String
) : DataSourceView

Parameters

viewName
Type: System..::.String
The name of the view to retrieve.

Return Value

Type: System.Web.UI..::.DataSourceView
Returns the named DataSourceView associated with the IDataSource.

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.

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.

Visual Basic
' 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
C#
// 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;
}

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

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

.NET Framework

Supported in: 3.5, 3.0, 2.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker