Export (0) Print
Expand All

ListSourceHelper Class

Used by data source controls when implementing the members defined by the IListSource interface. This class cannot be inherited.

Namespace:  System.Web.UI
Assembly:  System.Web (in System.Web.dll)

[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public static class ListSourceHelper

The ListSourceHelper class is a utility class provided to simplify implementation of the IListSource interface by data source controls. Data source controls that implement the IDataSource interface but do not extend the DataSourceControl class can use the static ListSourceHelper methods in their own implementations of the methods defined by the IListSource interface. Data source controls that extend from the DataSourceControl class inherit these method implementations automatically.

The following code example demonstrates the design pattern for a data source class that implements the IListSource methods.

#region Implementation of IDataSource

public virtual DataSourceView GetView(string viewName) {
    if (null == view) {
        view = new SomeDataSourceView(this);
    }
    return view;
}

public virtual ICollection GetViewNames() {
    ArrayList al = new ArrayList(1);
    al.Add(GetView(String.Empty).Name);
    return al as ICollection;
}

event EventHandler IDataSource.DataSourceChanged {
    add {
        ((IDataSource)this).DataSourceChanged += value;
    }
    remove {
        ((IDataSource)this).DataSourceChanged -= value;
    }
}

#endregion
#region Implementation of IListSource

bool IListSource.ContainsListCollection {
    get {
        return ListSourceHelper.ContainsListCollection(this);
    }
}

IList IListSource.GetList() {
    return ListSourceHelper.GetList(this);
}

#endregion

System.Object
  System.Web.UI.ListSourceHelper

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

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

Community Additions

ADD
Show:
© 2014 Microsoft