| |||||||
BoundField.DataField PropertySystem.Web.UI.WebControls Namespace BoundField Class .NET Framework version 2.0 Sets or retrieves the name of a field in the data source to bind to a BoundField. Syntax
Property Value
The property is read/write with no default value. RemarksUse the DataField property to specify the name of a field from the data source to bind to the BoundField control. The value of the specified field is displayed in the BoundField as a string, regardless of the data type of the field. To specify a custom display format for the field value, set 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 GridView. <asp:gridview id = "myGrid" runat = "server" ...
autogeneratecolumns=false>
<columns>
<asp:boundfield headertext = "Type"
datafield = "ProductType" />
<asp:boundfield headertext = "Brand/Model"
datafield = "ProductName" />
<asp:boundfield headertext = "Description"
datafield = "ProductDescription" />
<asp:boundfield headertext = "Price"
datafield = "UnitPrice"
htmlencode=false
dataformatstring = "{0:c}"
itemstyle-horizontalalign = "right" />
</columns>
</asp:gridview>
See Also |
| ||||||
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