Databases Reference
In-Depth Information
<asp:TextBox ID=”textBox” runat=”server” Text='<%# FieldValueEditString %>'
Columns='<%# Columns %>'
/>
With these changes made, you can now change the custom Customer entity template to
specify the
Columns
value for the
Address
field:
<unl:UnleashedControl runat=”server” DataField=”Address”
Columns=”65”
/>
NOTE
This example is using the
UnleashedControl
created earlier in this chapter. However,
this technique works just as well with the built-in
DynamicControl
provided by Dynamic
Data.
Figure 10.3 shows the web page generated by the Customer entity template with these
changes implemented. Notice how much wider the Address text box is now, allowing the
entire address value to be displayed without cutting it off.
FIGURE 10.3
Web page with configured Address field template.
Although the layout of the Customer form is still far from perfect, with this approach you
can continue working on the
Text_Edit
field template to expose the properties necessary
to configure the
TextBox
size to meet your requirements and personal taste. This could
include the
Width
property of the
TextBox
control or perhaps the
CssClass
or
Style
prop-
erties. Essentially, this is the same process you would follow to design and implement a
traditional
UserControl
that encapsulates a
TextBox
and needs to provide sufficient
means to configure its appearance.
Configuring Field Templates Programmatically
You can also configure the field templates and their data controls programmatically.
Instead of specifying custom attributes for
DynamicControl
as discussed in the previous