Main Page

  Previous Section Next Section


System.Web.UI.WebControls (system.web.dll)sealed class

This class represents an individual item from the list of a ListControl, such as CheckBoxList, DropDownList, RadioButtonList, and ListBox. The Text property returns the text for the list item, the Value property returns the contents of the "hidden" value attribute, and the Selected property indicates whether or not it is currently selected, which is useful for list controls that allow multiple selections.

public sealed class ListItem : System.Web.UI.IStateManager, System.Web.UI.IParserAccessor, 
        System.Web.UI.IAttributeAccessor {
// Public Constructors
   public ListItem( );
   public ListItem(string text);
   public ListItem(string text, string value);
// Public Instance Properties
   public AttributeCollection Attributes{get; }
   public bool Selected{set; get; }
   public string Text{set; get; }
   public string Value{set; get; }
// Public Static Methods
   public static ListItem FromString(string s);
// Public Instance Methods
   public override bool Equals(object o);          // overrides object
   public override int GetHashCode( );               // overrides object
   public override string ToString( );               // overrides object

Returned By

ListControl.SelectedItem, ListItemCollection.{FindByText( ), FindByValue( ), this}

Passed To

ListItemCollection.{Add( ), AddRange( ), Contains( ), IndexOf( ), Insert( ), Remove( )}

      Previous Section Next Section