While Field Templates layout and manage each DataField, they cannot be added directly
into your Web Form. They lack key pieces of information to work: the name of the DataField
and which Entity its on. The BLDDataField control remedies that.
BLDDataField control is always added within the DataBound control to provide
data from the Entity class to the content. It already knows the Entity class and
Entity instance containing the data from the DataSource control. You only need to assign
the DataField name to its DataField property.
You add a BLDDataField when you are laying out the HTML and need to include a Field Template.
Its always used in ListView and
FormView controls because they require you to lay out all of the HTML.
BLDListView and
BLDFormView controls also support them, when you switch from using
Pattern Templates to laying out the HTML in their <ItemTemplate> nodes.
<des:BLDFormView id="BLDFormView1" runat="server" DataSourceID="DataSource1" ContainerNamedPart="Div" >
<ItemTemplate>
<des:BLDDataField id="ProductName" runat="Server" DataField="ProductName" />
<br/>by
<des:BLDDataField id="SupplierHomePage" runat="server" DataField="Supplier.HomePage" />
<br/>
<des:BLDDataField id="UnitPrice" runat="server" DataField="UnitPrice" />
</ItemTemplate>
</des:BLDFormView>
When using GridView or
DetailsView, you will use the BLDField control
which generates a BLDDataField.
When using Pattern Templates (described later), you will use the
DataFieldInPattern object which also generates a BLDDataField.
Use the Source Code Browser to see examples of each DataBound control
using these objects.
In the next topic, you will
learn about the BLDLabel control.
Open the Source Code Browser (C# only)