System.Web 1.0.5000.0 2.0.0.0 Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details. System.Object System.Web.UI.IAttributeAccessor System.Web.UI.IParserAccessor System.Web.UI.IStateManager System.ComponentModel.TypeConverter(typeof(System.ComponentModel.ExpandableObjectConverter)) System.Web.UI.ControlBuilder(typeof(System.Web.UI.WebControls.ListItemControlBuilder))

A control represents an individual data item within a data-bound list control, such as a or a control.

There are several ways to specify the text displayed for an item in the list control. The most common method is by placing text in the inner HTML content. The inner HTML content is the text between the opening and closing tags of the control. You can also use the property to specify the text displayed in the list control for the item.

The property allows you to associate a value with the item in the list control, in addition to the text displayed in the control. For example, you can display text for an item in the list control, such as "Item 1", and use the property to specify a value for that item, such as "$1.99".

You can have any combination of the inner HTML content, , or properties set. The resulting HTML output for the control depends on the combination of these three properties that are set. For example, if all three properties are set as follows:

`<asp:ListItem Value="Value 1" Text="Item 1">Inner 1</asp:ListItem>`

The inner HTML content is used for rendered inner HTML content and the property is used for the Value attribute. The resulting HTML rendering output is:

`<option value="Value 1">Inner 1</option>`

The following table lists the combination of set properties and the corresponding property used for the rendered inner HTML content and Value attribute. The three columns on the left list the combination of set properties. The two columns on the right list which property value is used for the corresponding attribute.

Inner HTML content

Text property

Value property

Rendered Inner HTML content

Rendered Value attribute

Set

Set

Set

Inner HTML content

Value property

Set

Set

Not set

Inner HTML content

Inner HTML content

Set

Not set

Set

Inner HTML content

Value property

Set

Not set

Not set

Inner HTML content

Inner HTML text

Not set

Set

Set

Text property

Value property

Not set

Set

Not set

Text property

Text property

Not set

Not set

Set

Value property

Value property

Not set

Not set

Not set

Not set

Not set

Because the and properties each have a default value of an empty string, it is possible to have empty list items in the list control.

When a list control is displayed, any control with its property set to true appears highlighted in the control.

The control provides the property to allow you to specify whether a control is enabled or disabled. A control that is disabled is dimmed to indicate that it cannot be selected. Use this property to disable a control in either a control or a control.

You cannot use this property to disable a control in a control or control.

For a list of initial property values for an instance of , see the constructor.

This control can be used to display user input, which might include malicious client script. Check any information that is sent from a client for executable script, SQL statements, or other code before displaying it in your application. You can use validation controls to verify user input before displaying the input text in a control. ASP.NET provides an input request validation feature to block script and HTML in user input. For more information, see Securing Standard Controls, How to: Protect Against Script Exploits in a Web Application by Applying HTML Encoding to Strings, and Introduction to Validating User Input in ASP.NET Web Pages.

Represents a data item in a data-bound list control. This class cannot be inherited.

- Constructor

  Use this constructor to create and initialize a new instance of the class using default values.

  The following table shows initial property values for an instance of .

  Property

  Initial Value

  Text

  null

  Value

  null

  Enabled

  true

  Initializes a new instance of the class.

  1.0.5000.0
  2.0.0.0
- Constructor

  Use this constructor to create and initialize a new instance of the class using the specified text.

  The following table shows initial property values for an instance of .

  Property

  Initial Value

  Text

  The value of the parameter.

  Value

  null

  Enabled

  true

  Initializes a new instance of the class with the specified text data.

  The text to display in the list control for the item represented by the .
  1.0.5000.0
  2.0.0.0
- Constructor

  Use this constructor to create and initialize a new instance of the class using the specified text and value.

  The following table shows initial property values for an instance of .

  Property

  Initial Value

  Text

  The value of the parameter.

  Value

  The value of the parameter.

  Enabled

  true

  Initializes a new instance of the class with the specified text and value data.

  The text to display in the list control for the item represented by the .
  The value associated with the .
  1.0.5000.0
  2.0.0.0
- Constructor
  2.0.0.0

  The following table shows initial property values for an instance of .

  Property

  Initial Value

  Text

  The value of the parameter.

  Value

  The value of the parameter.

  Enabled

  The value of the parameter.

  Initializes a new instance of the class with the specified text, value, and enabled data.

  The text to display in the list control for the item represented by the .
  The value associated with the .
  Indicates whether the is enabled.
- Property
  System.Web.UI.AttributeCollection a

  Use the collection to manage the attribute name and value pairs declared in the opening and closing tags of the , but not directly supported by the class. You can programmatically add or remove attributes to the collection.

  Gets a collection of attribute name and value pairs for the that are not directly supported by the class.

  1.0.5000.0
  2.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.ComponentModel.Browsable(false)
- Property
  2.0.0.0
  System.Boolean To be added.

  The property allows you to specify whether a control is enabled or disabled. A control that is disabled is dimmed to indicate that it cannot be selected. Use this property to disable a control in either a control or a control.

  You cannot use this property to disable a control in a control or control.

  Gets or sets a value indicating whether the list item is enabled.

- Method
  System.Boolean `` To be added

  Determines whether the specified object has the same value and text as the current list item.

  true if the specified object is equivalent to the current list item; otherwise, false.

  The object to compare with the current list item. 1.0.5000.0 2.0.0.0
- Method
  System.Web.UI.WebControls.ListItem `` a

  Use the static method to create a from the specified text. This method sets the property of the to the text specified by the parameter.

  Creates a from the specified text.

  A that represents the text specified by the parameter.

  1.0.5000.0
  2.0.0.0
- Method
  System.Int32 a To be added

  Serves as a hash function for a particular type, and is suitable for use in hashing algorithms and data structures like a hash table.

  1.0.5000.0
  2.0.0.0
- Property
  System.Boolean To be added: an object of type 'bool'

  Use the property to determine whether the is currently selected in the list control that contains it. This property is commonly used, when iterating through a collection of objects in a list control, to determine whether an item is selected.

  Gets or sets a value indicating whether the item is selected.

  1.0.5000.0
  2.0.0.0
  System.ComponentModel.DefaultValue(false)
- Method
  1.0.5000.0
  2.0.0.0
  System.String `` To be added.

  This member is an explicit interface member implementation. It can be used only when the instance is cast to an interface.

  Returns the attribute value of the list item control having the specified attribute name.

  The value of the specified attribute.

- Method
  1.0.5000.0
  2.0.0.0
  System.Void `` `` To be added.

  This member is an explicit interface member implementation. It can be used only when the instance is cast to an interface.

  Sets an attribute of the list item control with the specified name and value.

  The value component of the attribute's name/value pair.
- Method
  1.0.5000.0
  2.0.0.0
  System.Void ``

  This member is an explicit interface member implementation. It can be used only when the instance is cast to an interface.

  Allows the property to be persisted as inner content.

  The specified object that is parsed.
- Property
  1.0.5000.0
  2.0.0.0
  System.Boolean To be added. To be added.

  For a description of this member, see .

- Method
  1.0.5000.0
  2.0.0.0
  System.Void ``

  This member is an explicit interface member implementation. It can be used only when the instance is cast to an interface.

  For a description of this member, see .

  An that contains the saved view state values for the control.
- Method
  1.0.5000.0
  2.0.0.0
  System.Object

  This member is an explicit interface member implementation. It can be used only when the instance is cast to an interface.

  For a description of this member, see .

  The that contains the view state changes.

- Method
  1.0.5000.0
  2.0.0.0
  System.Void

  This member is an explicit interface member implementation. It can be used only when the instance is cast to an interface.

  For a description of this member, see .

- Property
  System.String To be added: an object of type 'string'

  Use the property to specify or determine the text displayed in a list control for the item represented by the .

  If the property contains null, the get accessor returns the value of the property. If the property, in turn, contains null, is returned.

  The value of this property, when set, can be saved automatically to a resource file by using a designer tool. For more information, see and ASP.NET Globalization and Localization.

  Gets or sets the text displayed in a list control for the item represented by the .

  1.0.5000.0
  2.0.0.0
  System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.EncodedInnerDefaultProperty)
  System.ComponentModel.DefaultValue("")
- Method
  System.String To be added a To be added 1.0.5000.0 2.0.0.0
- Property
  System.String To be added: an object of type 'string'

  Use the property to specify or determine the value associated with the .

  If the property contains null, the get accessor returns the value of the property. If the property, in turn, contains null, is returned.

  The value of this property, when set, can be saved automatically to a resource file by using a designer tool. For more information, see and ASP.NET Globalization and Localization.

  Gets or sets the value associated with the .

  1.0.5000.0
  2.0.0.0
  System.ComponentModel.DefaultValue("")