| |||||||
BoundColumn.DataField PropertySystem.Web.UI.WebControls Namespace BoundColumn Class Sets or retrieves the field from the data source to bind to the column. Syntax
Property Value
The property is read/write with no default value. RemarksUse the DataField property to specify the field name from a data source to bind to the column. You can specify a custom display format for the field values by setting the DataFormatString property. ExampleThe following example demonstrates how to set the DataField property at design time, to specify the names of the fields in the data source to bind to the columns of a DataGrid. <asp:datagrid id = "myGrid" runat = "server" ...
autogeneratecolumns=false>
<columns>
<asp:boundcolumn headertext = "Type"
datafield = "ProductType" />
<asp:boundcolumn headertext = "Brand/Model"
datafield = "ProductName" />
<asp:boundcolumn headertext = "Description"
datafield = "ProductDescription" />
<asp:boundcolumn headertext = "Price"
datafield = "UnitPrice"
dataformatstring = "{0:c}"
itemstyle-horizontalalign = "right" />
</columns>
</asp:datagrid>
See AlsoBoundColumn Members Adding Bound Columns to a DataGrid Control |
| ||||||
Check out related books at Amazon
© 2000-2008 Rey Nuñez All rights reserved.
If you have any question, comment or suggestion
about this site, please send us a note
You can help support aspxtreme