This documentation is archived and is not being maintained.

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.

Namespace:  System.Web.UI.HtmlControls
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::String
The 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.

ExceptionCondition
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.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

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.
Show: