Table of Contents
DataFields Property

Specifies a list of fields used during data binding when binding to an ADO.NET data object. Use '|' to separate multiple fields.

Syntax
 public String DataFields { get; set; }
Remarks

DataFields must be provided to abstract hierarchical data structure from a data source of DataTable, DataView or an object that implements IDataReader interface. For example, Data fields "Country|City|ZipCode" abstract hierarchical structure from the following DataTable (or DataView, IDataReader):

Country City ZipCode
U.S.A New York 10471
U.S.A New York 10471
Canada Toronto M1W2V6
U.K London W114BE

And results the following menu:

You can use a JOIN to easily return such data from a database.

By default, values in fields specified in DataFields will also be used to populate Text property, however, you can change this mapping by providing your own DataBinding object through Bindings property.

When bind to a DataSet, DataFields is not required as it is not used to abstract hierarchical data structure. However, it could be used to populate navigation item text. When data source is a DataSet, DataFields specifies a list of field names which values will be used as item text.

DataFields is not used when bind to an object that implement IEnumerable.

Refer to data binding for more details.

See Also