HtmlSelect::DataMember Property
Gets or sets the set of data to bind to the HtmlSelect control from a DataSource property with multiple sets of data.
Assembly: System.Web (in System.Web.dll)
<asp:HtmlSelect DataMember="String" />
Property Value
Type: System::StringThe set of data to bind to the HtmlSelect control from a DataSource with multiple sets of data. The default value is an empty string (""), which indicates the property has not been set.
| Exception | Condition |
|---|---|
| HttpException | The DataMember property is set during the data-binding phase of the HtmlSelect control. |
If the DataSource property contains multiple sets of data, use the DataMember property to specify which set of data to bind to the control. For example, if you have a System.Data::DataSet object with multiple tables, use this property to indicate which table to bind to the control.
After you have specified the data source to bind to the control, you can then specify which fields from the data source to bind to the ListItem::Text and ListItem::Value properties of each item in the control by setting the DataTextField and DataValueField properties, respectively.
The following code example demonstrates how to use the DataMember property to specify a set of data to bind to the HtmlSelect control from a DataSource property with multiple sets of data.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.