This abstract base class for all list controls includes data-binding functionality (such as DataTextFormatString, which specifies the formatting of bound text), an Items collection, and properties for returning the first selected item (SelectedIndex and SelectedItem).
Note that items in the ListControl class do not correspond to the specific derived control type. For example, a CheckBoxList control returns its selected item as a ListItem, as all list controls do, not as an individual checkbox control.
public abstract class ListControl : WebControl { // Public Constructors public ListControl( ); // Public Instance Properties public virtual bool AutoPostBack{set; get; } public virtual string DataMember{set; get; } public virtual object DataSource{set; get; } public virtual string DataTextField{set; get; } public virtual string DataTextFormatString{set; get; } public virtual string DataValueField{set; get; } public virtual ListItemCollection Items{get; } public virtual int SelectedIndex{set; get; } public virtual ListItem SelectedItem{get; } public virtual string SelectedValue{set; get; } // Public Instance Methods public virtual void ClearSelection( ); // Protected Instance Methods protected override void LoadViewState(object savedState); // overrides WebControl protected override void OnDataBinding(EventArgs e); // overrides System.Web.UI.Control protected override void OnPreRender(EventArgs e); // overrides System.Web.UI.Control protected virtual void OnSelectedIndexChanged( EventArgs e); protected override object SaveViewState( ); // overrides WebControl protected override void TrackViewState( ); // overrides WebControl// Events public event EventHandler SelectedIndexChanged; }