DataSourceControl.GetViewNames Method ()
Assembly: System.Web (in System.Web.dll)
The ListSourceHelper class, which is used for the DataSourceControl class's IListSource implementation, checks the 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 returns null, which is the default implementation of the method, IListSource.ContainsListCollection returns false and IListSource.GetList returns null.
The following code example demonstrates how a class that extends the DataSourceControl class can override the default implementation, which returns null, 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.
' The ListSourceHelper class calls GetList, which ' calls the DataSourceControl.GetViewNames method. ' Override the original implementation to return ' a collection of one element, the default view name. Protected Overrides Function GetViewNames() As ICollection Dim al As New ArrayList(1) al.Add(CsvDataSourceView.DefaultViewName) Return CType(al, ICollection) End Function 'GetViewNames End Class 'CsvDataSource
Available since 2.0