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.Web.UI.WebControls.DataBoundControl System.Web.UI.IEditableTextControl System.Web.UI.ControlValueProperty("SelectedValue", null) System.Web.UI.ParseChildren(true, "Items") System.ComponentModel.Designer("System.Web.UI.Design.WebControls.ListControlDesigner, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.ComponentModel.Design.IDesigner") System.ComponentModel.DefaultEvent("SelectedIndexChanged") System.Web.UI.DataBindingHandler("System.Web.UI.Design.WebControls.ListControlDataBindingHandler, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")

An instance of the abstract class cannot be created directly. Instead, this class is inherited by other classes, such as the , , , and classes, to provide common basic functionality.

The properties of the class allow you to specify the source of the data to populate the list control. Use the property to specify the data source to bind to the list control. If the data source contains more than one table, use the property to specify the table to use. You can bind different fields in the data source to the and properties of the items in the list control by setting the and properties, respectively. The text displayed for each item in the list control can by formatted by setting the property.

All items displayed in the list control are stored in the collection. You can programmatically specify or determine the index of a selected item in the list control by using the property. The properties of the selected item can be accessed by using the property.

The class provides the event, which is raised when the selection in the list control changes between posts to the server. This allows you to provide a custom handler for this event. For more information about handling events, see Consuming Events.

The class implements the interface so that derived list-type controls can be used in the template mode of other controls.

Serves as the abstract base class that defines the properties, methods, and events common for all list-type controls.

- Constructor
  To be added

  Initializes a new instance of the class.

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

  The method is used primarily by control developers to insert the additional attributes and styles into the output stream for controls that are derived from the class.

  Applies HTML attributes and styles to render to the specified object.

- Property
  2.0.0.0
  System.Web.UI.Themeable(false)
  System.ComponentModel.DefaultValue(false)
  System.Boolean To be added.

  The property allows you to add items to the object before data binding occurs. After data binding, the items collection contains both the items from the data source and the previously added items.

  The value of this property is stored in view state.

  This property cannot be set by themes or style sheet themes. For more information, see and ASP.NET Themes Overview.

  Gets or sets a value that indicates whether list items are cleared before data binding.

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

  Set this property to true if the server needs to capture the selection as soon as it is made. For example, other controls on the Web page can be automatically filled depending on the user's selection from a list control.

  This property can be used to allow automatic population of other controls on the Web page based on a user's selection from a list.

  The value of this property is stored in view state.

  This property cannot be set by themes or style sheet themes. For more information, see and ASP.NET Themes Overview.

  Gets or sets a value indicating whether a postback to the server automatically occurs when the user changes the list selection.

  1.0.5000.0
  2.0.0.0
  System.ComponentModel.DefaultValue(false)
  System.Web.UI.Themeable(false)
- Property
  2.0.0.0
  System.ComponentModel.DefaultValue(false)
  System.Web.UI.Themeable(false)
  System.Boolean To be added.

  Use the property to determine whether validation is performed when a control is clicked. Page validation determines whether the input controls that are associated with a validation control on the page all pass the validation rules that are specified by the validation control.

  By default, clicking a control that is derived from the class does not cause page validation. To perform page validation when the control that is derived from the class is clicked, set the property to true.

  When the value of the property is set to true, you can also use the property to specify the name of the validation group for which the control causes validation.

  The value of this property is stored in view state.

  This property cannot be set by themes or style sheet themes. For more information, see and ASP.NET Themes Overview.

  Gets or sets a value indicating whether validation is performed when a control that is derived from the class is clicked.

- Method
  System.Void

  Use this method to reset the control so that no items are selected.

  Clears out the list selection and sets the property of all items to false.

  1.0.5000.0
  2.0.0.0
- Property
  System.String To be added To be added: an object of type 'string' To be added 1.0.5000.0 2.0.0.0 System.ComponentModel.DefaultValue("") System.Web.UI.Themeable(false)
- Property
  System.Object To be added To be added: an object of type 'object' To be added 1.0.5000.0 2.0.0.0 System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden) System.ComponentModel.DefaultValue(null) System.Web.UI.Themeable(false) System.ComponentModel.Bindable(true)
- Property
  System.String To be added: an object of type 'string'

  Use this property to specify a field in the property to display as the items of the list in a list control.

  The value of this property is stored in view state.

  This property cannot be set by themes or style sheet themes. For more information, see and ASP.NET Themes Overview.

  Gets or sets the field of the data source that provides the text content of the list items.

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

  Use the property to provide a custom display format the items in a list control.

  The data format string consists of two parts, separated by a colon, in the form { : }. For example, the formatting string {0:F2} would format the cell to display a fixed point number with two decimal places.

  The entire string must be enclosed in braces to indicate that it is a format string and not a literal string. Any text outside the braces is displayed as literal text.

  The value before the colon ( in the general example) specifies the parameter index in a zero-based list of parameters.

  This value can only be set to 0 because there is only one value in each cell.

  The character after the colon ( in the general example) specifies the format to display the value in. The following table lists the common formats.

  Format character

  Description

  C

  Displays numeric values in currency format.

  D

  Displays numeric values in decimal format.

  E

  Displays numeric values in scientific (exponential) format.

  F

  Displays numeric values in fixed format.

  G

  Displays numeric values in general format.

  N

  Displays numeric values in number format.

  X

  Displays numeric values in hexadecimal format.

  The format character is not case-sensitive, except for X, which displays the hexadecimal characters in the case specified.

  The value after the format character ( in the general example) specifies the number of significant digits or decimal places to display.

  The following table contains examples of formatting strings and the results. It assumes standard English settings.

  Numeric Value

  Format String

  Result

  12345.6789

  "{0:C}"

  $12,345.68

  -12345.6789

  "{0:C}"

  ($12,345.68)

  12345

  "{0:D}"

  12345

  12345

  "{0:D8}"

  00012345

  12345.6789

  "{0:E}"

  1234568E+004

  12345.6789

  "{0:E10}"

  1.2345678900E+004

  12345.6789

  "{0:F}"

  12345.68

  12345.6789

  "{0:F0}"

  12346

  12345.6789

  "{0:G}"

  12345.6789

  123456789

  "{0:G7}"

  1.234568E8

  12345.6789

  "{0:N}"

  12,345.68

  123456789

  "{0:N4}"

  123,456,789.0000

  12345.6789

  "Total: {0:C}"

  Total: $12345.68

  For more information on formatting strings, see Formatting Overview.

  The value of this property is stored in view state.

  This property cannot be set by themes or style sheet themes. For more information, see and ASP.NET Themes Overview.

  Gets or sets the formatting string used to control how data bound to the list control is displayed.

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

  Use this property to specify the field that contains the value of each item in a list control.

  The value of this property is stored in view state.

  This property cannot be set by themes or style sheet themes. For more information, see and ASP.NET Themes Overview.

  Gets or sets the field of the data source that provides the value of each list item.

  1.0.5000.0
  2.0.0.0
  System.ComponentModel.DefaultValue("")
  System.Web.UI.Themeable(false)
- Property
  System.Web.UI.WebControls.ListItemCollection To be added: an object of type 'ListItemCollection'

  Use this property to get the properties of items in the list control. This property can be used to determine the selected items in the list control.

  Gets the collection of items in the list control.

  1.0.5000.0
  2.0.0.0
  System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerDefaultProperty)
  System.ComponentModel.MergableProperty(false)
  System.ComponentModel.DefaultValue(null)
  System.ComponentModel.Editor("System.Web.UI.Design.WebControls.ListItemsCollectionEditor,System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
- Method
  System.Void ``

  The method is used to load the previously saved view state of the -derived control.

  This method is used primarily by control developers when extending the control.

  Loads the previously saved view state of the control.

  An that represents the state of the -derived control. 1.0.5000.0 2.0.0.0
- Method
  System.Void `` To be added

  Raises the event.

  An that contains event data. 1.0.5000.0 2.0.0.0
- Method
  System.Void ``

  This method notifies the server control to perform any necessary prerendering steps prior to saving view state and rendering content .It is generally used by control developers when extending the class.

  The method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

  Raises the event.

  An that contains the event data. 1.0.5000.0 2.0.0.0
- Method
  System.Void ``

  The event is raised when the selection from the list control changes between posts to the server.

  A list control must persist some values between posts to the server for this event to work correctly. Be sure that view state is enabled for the list control.

  Raising an event invokes the event handler through a delegate. For more information, see Consuming Events.

  The method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

  Raises the event. This allows you to provide a custom handler for the event.

  A that contains the event data. 1.0.5000.0 2.0.0.0
- Method
  2.0.0.0
  System.Void ``

  The method is called by the control that is derived from the class to raise the event. Generally, the method is used by control developers when extending the class.

  The method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

  Raises the event.

  An that contains event data.
- Method
  2.0.0.0
  System.Void ``

  The method is a helper method that is called by the control that is derived from the class to bind the specified data source to the control.

  Binds the specified data source to the control that is derived from the class.

  An that represents the data source.
- Method
  2.0.0.0
  System.Void

  The method calls the method after data is retrieved to bind data to elements of the data-bound control. For more information, see .

  Retrieves data from the associated data source.

- Method
  2.0.0.0
  System.Void ``

  Use the method to render the items in the control to the client.

  Renders the items in the control.

  The that represents the output stream used to write content to a Web page.
- Method
  System.Object

  The method is a helper method called by the control to save the state of the control.

  This method is used primarily by control developers when extending the control.

  Saves the current view state of the -derived control and the items it contains.

  An that contains the saved state of the control.

  1.0.5000.0
  2.0.0.0
- Property
  System.Int32 To be added: an object of type 'int'

  Use this property to determine the index of the currently selected item in the list if the list control allows only one selection. If the list control supports multiple selections, use this property to determine the lowest index of the selected items.

  The value of the property is not specifically saved on postback. It is restored on postback using the property. For example, if the property is 4, on postback, the property is set to the index of the object that has a property of 4. If more than one object has a property of 4, the first item in the collection is selected.

  This property cannot be set by themes or style sheet themes. For more information, see and ASP.NET Themes Overview.

  Gets or sets the lowest ordinal index of the selected items in the list.

  1.0.5000.0
  2.0.0.0
  System.Web.UI.Themeable(false)
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.ComponentModel.DefaultValue(0)
  System.ComponentModel.Browsable(false)
  System.ComponentModel.Bindable(true)
- Event
  System.EventHandler

  The event is raised when the selection from the list control changes between posts to the server.

  A list control must persist some values between posts to the server for this event to work correctly. Be sure that view state is enabled for the list control.

  For more information about handling events, see Consuming Events.

  Occurs when the selection from the list control changes between posts to the server.

  1.0.5000.0
  2.0.0.0
- Property
  System.Web.UI.WebControls.ListItem To be added: an object of type 'ListItem'

  If the list control allows only a single selection, use this property to get the individual properties of the selected item. If the list control allows multiple selections, use this property to get the properties of the lowest indexed item selected from the list control.

  Gets the selected item with the lowest index in the list control.

  1.0.5000.0
  2.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.ComponentModel.DefaultValue(null)
  System.ComponentModel.Browsable(false)
- Property
  System.String a

  This property returns the property of the selected . The property is commonly used to determine the value of the selected item in the list control. If multiple items are selected, the value of the selected item with the lowest index is returned. If no item is selected, an empty string ("") is returned.

  The property can also be used to select an item in the list control by setting it with the value of the item.

  This property cannot be set by themes or style sheet themes. For more information, see and ASP.NET Themes Overview.

  When the selected value is not in the list of available values and a postback is performed, an exception is thrown. The following example shows how to catch an invalid value before postback occurs:

  `Me.DropDownList1.Items.Add(New ListItem( Text="Hello", Value="1" )) If DropDownList1.Items.FindByValue("2") IsNot Nothing Then Response.Write("Found") End If` `this.DropDownList1.Items.Add(new ListItem{ Text="Hello", Value="1" }); if(DropDownList1.Items.FindByValue("2") != null) { Response.Write("Found"); }`

  Gets the value of the selected item in the list control, or selects the item in the list control that contains the specified value.

  1.0.5000.0
  2.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.ComponentModel.DefaultValue("")
  System.ComponentModel.Browsable(false)
  System.Web.UI.Themeable(false)
  System.ComponentModel.Bindable(true, System.ComponentModel.BindingDirection.TwoWay)
- Method
  2.0.0.0
  System.Void ``

  The method is a helper method that maintains the selected item in the control after a page is posted.

  Sets the property of a control after a page is posted.

  The index of the selected item in the collection.
- Property
  1.0.5000.0
  2.0.0.0
  System.Web.UI.HtmlTextWriterTag To be added.

  The property allows the output stream to write the appropriate HTML markup for the control that is derived from the class.

  Gets the value for the control.

- Property
  2.0.0.0
  System.ComponentModel.Browsable(false)
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.ComponentModel.DefaultValue("")
  System.Web.UI.Themeable(false)
  System.String To be added.

  The property gets and sets the same value that the e property does.

  The property is commonly used to determine the value of the selected item in the control. If no item is selected, an empty string ("") is returned.

  You can also use the property to select an item in the control by setting it with the value of the item. If no items in the control contain the specified value, an exception is thrown.

  Control developers can override the property to support features that are not related to the property.

  This property cannot be set by themes or style sheet themes. For more information, see and ASP.NET Themes Overview.

  Gets or sets the property of the control.

- Event
  2.0.0.0
  System.EventHandler

  The event is raised when the and properties change.

  Raising an event invokes the event handler through a delegate. For more information, see Consuming Events.

  The method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

  Occurs when the and properties change.

- Method
  System.Void

  This method is overridden to mark the starting point to begin tracking and saving changes to the control as part of the control's view state.

  This method is used primarily by control developers when extending .

  Marks the starting point to begin tracking and saving view-state changes to a -derived control.

  1.0.5000.0
  2.0.0.0
- Property
  2.0.0.0
  System.ComponentModel.DefaultValue("")
  System.Web.UI.Themeable(false)
  System.String To be added.

  Validation groups allow you to assign validation controls on a page to a specific category. Each validation group can be validated independently from other validation groups on the page. Use the property to specify the name of the validation group for which the control that is derived from the class causes validation when it posts back to the server.

  The property has an effect only when the value of the property is set to true. When you specify a value for the property, only the validation controls that are part of the specified group are validated when the control posts back to the server. If you do not specify a value for the property and the property is set to true, all validation controls on the page that are not assigned to a validation group are validated when the control posts back to the server.

  The value of this property is stored in view state.

  This property cannot be set by themes or style sheet themes. For more information, see and ASP.NET Themes Overview.

  Gets or sets the group of controls for which the control that is derived from the class causes validation when it posts back to the server.

- Method
  2.0.0.0
  System.Void

  The method does nothing if multiselection is supported. Otherwise, it throws an exception.

  Determines whether the list control supports multiselection mode.