November Happy Hour will be moved to Thursday December 5th.

Class GenericDataSourceView<T>

Base class for EPiServer DataSource controls.

Inheritance
System.Object
GenericDataSourceView<T>
Implements
System.Web.UI.IStateManager
Namespace: EPiServer.Web.WebControls
Assembly: EPiServer.dll
Version: 9.12.2
Syntax
public class GenericDataSourceView<T> : DataSourceView, IStateManager where T : class, IDataSourceMethods, IDataSource
Type Parameters
Name Description
T
Remarks

ViewState will contain an object array "o" with length 4. The elements will serve the different parameter collections o[0] - SelectParameters o[1] - InsertParameters o[2] - UpdateParameters o[3] - DeleteParameters

Constructors

GenericDataSourceView(IDataSource, String)

Initializes a new instance of the GenericDataSourceView<T> class.

Declaration
public GenericDataSourceView(IDataSource dataSource, string viewName)
Parameters
Type Name Description
System.Web.UI.IDataSource dataSource

The data source.

System.String viewName

Name of the view.

GenericDataSourceView(IDataSource, String, Boolean, Boolean, Boolean)

Initializes a new instance of the GenericDataSourceView<T> class.

Declaration
public GenericDataSourceView(IDataSource dataSource, string viewName, bool canUpdate, bool canDelete, bool canInsert)
Parameters
Type Name Description
System.Web.UI.IDataSource dataSource

The data source.

System.String viewName

Name of the view.

System.Boolean canUpdate

if set to true update is supported.

System.Boolean canDelete

if set to true delete is supported.

System.Boolean canInsert

if set to true insert is supported.

GenericDataSourceView(IDataSource, String, Boolean, Boolean, Boolean, Boolean, Boolean)

Initializes a new instance of the GenericDataSourceView<T> class.

Declaration
public GenericDataSourceView(IDataSource dataSource, string viewName, bool canUpdate, bool canDelete, bool canInsert, bool canPage, bool canRetrieveTotalCount)
Parameters
Type Name Description
System.Web.UI.IDataSource dataSource

The data source.

System.String viewName

Name of the view.

System.Boolean canUpdate

if set to true update is supported.

System.Boolean canDelete

if set to true delete is supported.

System.Boolean canInsert

if set to true insert is supported.

System.Boolean canPage

if set to true paging is supported.

System.Boolean canRetrieveTotalCount

if set to true retrieving total count supported.

Properties

CanDelete

Gets a value indicating whether the System.Web.UI.DataSourceView object associated with the current System.Web.UI.DataSourceControl object supports the System.Web.UI.DataSourceView.ExecuteDelete(System.Collections.IDictionary,System.Collections.IDictionary) operation.

Declaration
public override bool CanDelete { get; }
Property Value
Type Description
System.Boolean

CanInsert

Gets a value indicating whether the System.Web.UI.DataSourceView object associated with the current System.Web.UI.DataSourceControl object supports the System.Web.UI.DataSourceView.ExecuteInsert(System.Collections.IDictionary) operation.

Declaration
public override bool CanInsert { get; }
Property Value
Type Description
System.Boolean

CanPage

Gets a value indicating whether the System.Web.UI.DataSourceView object associated with the current System.Web.UI.DataSourceControl object supports paging through the data retrieved by the System.Web.UI.DataSourceView.ExecuteSelect(System.Web.UI.DataSourceSelectArguments) method.

Declaration
public override bool CanPage { get; }
Property Value
Type Description
System.Boolean

CanRetrieveTotalRowCount

Gets a value indicating whether the System.Web.UI.DataSourceView object associated with the current System.Web.UI.DataSourceControl object supports retrieving the total number of data rows, instead of the data.

Declaration
public override bool CanRetrieveTotalRowCount { get; }
Property Value
Type Description
System.Boolean

CanUpdate

Gets a value indicating whether the System.Web.UI.DataSourceView object associated with the current System.Web.UI.DataSourceControl object supports the System.Web.UI.DataSourceView.ExecuteUpdate(System.Collections.IDictionary,System.Collections.IDictionary,System.Collections.IDictionary) operation.

Declaration
public override bool CanUpdate { get; }
Property Value
Type Description
System.Boolean

DeleteParameters

Gets the parameters that will be used for delete operations.

Declaration
public ParameterCollection DeleteParameters { get; }
Property Value
Type Description
System.Web.UI.WebControls.ParameterCollection

InsertParameters

Gets the parameters that will be used for insert operations.

Declaration
public ParameterCollection InsertParameters { get; }
Property Value
Type Description
System.Web.UI.WebControls.ParameterCollection

SelectParameters

Gets the parameters that will be used for select operations.

Declaration
public ParameterCollection SelectParameters { get; }
Property Value
Type Description
System.Web.UI.WebControls.ParameterCollection

UpdateParameters

Gets the parameters that will be used for updated operations.

Declaration
public ParameterCollection UpdateParameters { get; }
Property Value
Type Description
System.Web.UI.WebControls.ParameterCollection

Methods

ExecuteDelete(IDictionary, IDictionary)

Deletes items according to given DataSource implementation

Declaration
protected override int ExecuteDelete(IDictionary keys, IDictionary oldValues)
Parameters
Type Name Description
System.Collections.IDictionary keys

keys

System.Collections.IDictionary oldValues

old values

Returns
Type Description
System.Int32

number of deleted items

ExecuteInsert(IDictionary)

Inserts items according to given DataSource implementation

Declaration
protected override int ExecuteInsert(IDictionary values)
Parameters
Type Name Description
System.Collections.IDictionary values

values

Returns
Type Description
System.Int32

number of inserted items

ExecuteSelect(DataSourceSelectArguments)

Selects items according to given DataSource implementation

Declaration
protected override IEnumerable ExecuteSelect(DataSourceSelectArguments arguments)
Parameters
Type Name Description
System.Web.UI.DataSourceSelectArguments arguments

select arguments

Returns
Type Description
System.Collections.IEnumerable

Collection of items

ExecuteUpdate(IDictionary, IDictionary, IDictionary)

Updates items according to given DataSource implementation

Declaration
protected override int ExecuteUpdate(IDictionary keys, IDictionary values, IDictionary oldValues)
Parameters
Type Name Description
System.Collections.IDictionary keys

keys

System.Collections.IDictionary values

values

System.Collections.IDictionary oldValues

oldValues

Returns
Type Description
System.Int32

number of updated records

LoadViewState(Object)

Loads data from view state.

Declaration
protected virtual void LoadViewState(object savedState)
Parameters
Type Name Description
System.Object savedState

The view state object.

OnDeleted(DataSourceStatusEventArgs)

Raises the Deleted event.

Declaration
protected virtual void OnDeleted(DataSourceStatusEventArgs e)
Parameters
Type Name Description
DataSourceStatusEventArgs e

The DataSourceStatusEventArgs instance containing the event data.

OnDeleting(DataSourceMethodEventArgs)

Raises the Deleting event.

Declaration
protected virtual void OnDeleting(DataSourceMethodEventArgs e)
Parameters
Type Name Description
DataSourceMethodEventArgs e

The DataSourceMethodEventArgs instance containing the event data.

OnEventOccurred(DataSourceStatusEventArgs, Object)

Raises an event notifying that an operation has occurred. The operation is specified by the eventKey which is one of the following.

Declaration
protected virtual void OnEventOccurred(DataSourceStatusEventArgs e, object eventKey)
Parameters
Type Name Description
DataSourceStatusEventArgs e

The DataSourceStatusEventArgs instance containing the event data.

System.Object eventKey

The event key.

OnEventOccurring(DataSourceMethodEventArgs, Object)

Raises an event notifying that an operation is occuring. The operation is specified by the eventKey which is one of the following.

Declaration
protected virtual void OnEventOccurring(DataSourceMethodEventArgs e, object eventKey)
Parameters
Type Name Description
DataSourceMethodEventArgs e

The DataSourceMethodEventArgs instance containing the event data.

System.Object eventKey

The event key.

OnInserted(DataSourceStatusEventArgs)

Raises the Inserted event.

Declaration
protected virtual void OnInserted(DataSourceStatusEventArgs e)
Parameters
Type Name Description
DataSourceStatusEventArgs e

The DataSourceStatusEventArgs instance containing the event data.

OnInserting(DataSourceMethodEventArgs)

Raises the Inserting event.

Declaration
protected virtual void OnInserting(DataSourceMethodEventArgs e)
Parameters
Type Name Description
DataSourceMethodEventArgs e

The DataSourceMethodEventArgs instance containing the event data.

OnSelected(DataSourceStatusEventArgs)

Raises the Selected event.

Declaration
protected virtual void OnSelected(DataSourceStatusEventArgs e)
Parameters
Type Name Description
DataSourceStatusEventArgs e

The DataSourceStatusEventArgs instance containing the event data.

OnSelecting(DataSourceMethodEventArgs)

Raises the Selecting event.

Declaration
protected virtual void OnSelecting(DataSourceMethodEventArgs e)
Parameters
Type Name Description
DataSourceMethodEventArgs e

The DataSourceMethodEventArgs instance containing the event data.

OnUpdated(DataSourceStatusEventArgs)

Raises the Updated event.

Declaration
protected virtual void OnUpdated(DataSourceStatusEventArgs e)
Parameters
Type Name Description
DataSourceStatusEventArgs e

The DataSourceStatusEventArgs instance containing the event data.

OnUpdating(DataSourceMethodEventArgs)

Raises the Updating event.

Declaration
protected virtual void OnUpdating(DataSourceMethodEventArgs e)
Parameters
Type Name Description
DataSourceMethodEventArgs e

The DataSourceMethodEventArgs instance containing the event data.

SaveViewState()

Saves changes to the GenericDataSourceView<T> to an System.Object for storing in the associated control's ViewState.

Declaration
protected virtual object SaveViewState()
Returns
Type Description
System.Object

The System.Object that contains the view state changes.

TrackViewState()

Instructs the GenericDataSourceView<T> to track changes to its view state.

Declaration
protected virtual void TrackViewState()

Events

Deleted

Occurs when a System.Web.UI.DataSourceView.ExecuteDelete(System.Collections.IDictionary,System.Collections.IDictionary) operation has completed.

Declaration
public event DataSourceStatusEventHandler Deleted
Event Type
Type Description
DataSourceStatusEventHandler

Deleting

Occurs before a System.Web.UI.DataSourceView.ExecuteDelete(System.Collections.IDictionary,System.Collections.IDictionary) operation.

Declaration
public event DataSourceMethodEventHandler Deleting
Event Type
Type Description
DataSourceMethodEventHandler

Inserted

Occurs when a System.Web.UI.DataSourceView.ExecuteInsert(System.Collections.IDictionary) operation has completed.

Declaration
public event DataSourceStatusEventHandler Inserted
Event Type
Type Description
DataSourceStatusEventHandler

Inserting

Occurs before a System.Web.UI.DataSourceView.ExecuteInsert(System.Collections.IDictionary) operation.

Declaration
public event DataSourceMethodEventHandler Inserting
Event Type
Type Description
DataSourceMethodEventHandler

Selected

Occurs when a System.Web.UI.DataSourceView.ExecuteSelect(System.Web.UI.DataSourceSelectArguments) operation has completed.

Declaration
public event DataSourceStatusEventHandler Selected
Event Type
Type Description
DataSourceStatusEventHandler

Selecting

Occurs before a System.Web.UI.DataSourceView.ExecuteSelect(System.Web.UI.DataSourceSelectArguments) operation.

Declaration
public event DataSourceMethodEventHandler Selecting
Event Type
Type Description
DataSourceMethodEventHandler

Updated

Occurs when a System.Web.UI.DataSourceView.ExecuteUpdate(System.Collections.IDictionary,System.Collections.IDictionary,System.Collections.IDictionary) operation has completed.

Declaration
public event DataSourceStatusEventHandler Updated
Event Type
Type Description
DataSourceStatusEventHandler

Updating

Occurs before a System.Web.UI.DataSourceView.ExecuteUpdate(System.Collections.IDictionary,System.Collections.IDictionary,System.Collections.IDictionary) operation.

Declaration
public event DataSourceMethodEventHandler Updating
Event Type
Type Description
DataSourceMethodEventHandler

Implements

System.Web.UI.IStateManager

Extension Methods