Export (0) Print
Expand All

DataSourceControl.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)

'Declaration
Protected MustOverride Function GetView ( _
	viewName As String _
) As DataSourceView

Parameters

viewName
Type: System.String
The name of the DataSourceView to retrieve. In data source controls that support only one view, such as SqlDataSource, this parameter is ignored.

Return Value

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

You can enumerate through the set of views currently associated with the data source control by calling the GetViewNames method.

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, does all the work necessary to retrieve data from the underlying data store, and performs operations such as sorting, inserting, deleting, and updating.

NoteNote

The DataSourceControl class's default implementation returns Nothing. If you extend the DataSourceControl class, override the GetView method to return the specified DataSourceView object.

The following code example demonstrates how a data source control class that extends the DataSourceControl class 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 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


.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

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

Community Additions

ADD
Show:
© 2014 Microsoft