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)
public: virtual property String^ DataMember { String^ get (); void set (String^ value); }
<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, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.