This topic has not yet been rated - Rate this topic

DataSourceControl.GetViewNames Method

Gets a collection of names, representing the list of DataSourceView objects associated with the DataSourceControl control.

Namespace:  System.Web.UI
Assembly:  System.Web (in System.Web.dll)
abstract GetViewNames : unit -> ICollection 
override GetViewNames : unit -> ICollection 

Return Value

Type: System.Collections.ICollection
An ICollection that contains the names of the DataSourceView objects associated with the DataSourceControl.

The ICollection collection of names is the allowable set of values that can be passed to the GetView method.

The ListSourceHelper class, which is used for the DataSourceControl class's IListSource implementation, checks the GetViewNames method for both the IListSource.ContainsListCollection and IListSource.GetList calls to determine whether the data source control is associated with one or more data source views. If GetViewNames returns a null reference (Nothing in Visual Basic), which is the default implementation of the method, IListSource.ContainsListCollection returns false and IListSource.GetList returns a null reference (Nothing in Visual Basic).

NoteNote

The DataSourceControl class's default implementation returns a null reference (Nothing in Visual Basic). If you extend the DataSourceControl class, override the GetViewNames method to return a collection of view names.

The following code example demonstrates how a class that extends the DataSourceControl class can override the default implementation, which returns a null reference (Nothing in Visual Basic), to provide a collection of view names. The CsvDataSource class only supports one view; therefore, a collection of one element with the default view name is returned. This code example is part of a larger example provided for the DataSourceControl class.

No code example is currently available or this language may not be supported.

.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.
Did you find this helpful?
(1500 characters remaining)

Community Additions

ADD
© 2013 Microsoft. All rights reserved.