Databases Reference
In-Depth Information
Figure 10.2. shows how the Customer edit page looks with the MultilineText field
template used for the Address property.
FIGURE 10.2 Web page with multiline address field template.
Unfortunately, the attempt to use the MultilineText template does not give the right
solution. The TextBox control generated by this field template is simply too big. With
several rows of empty space, it not only takes too much real estate, but can also mislead
the users into thinking that they can put the entire address, including city, state, and zip
code, into the same field.
Configuring Field Templates Declaratively
DynamicControl also allows you to configure the field template it instantiates. You can set
any public property of the field template by specifying custom attributes for its parent
DynamicControl .
First, you need to modify the appropriate field template to define a property you want to
assign. In this example, the Text_Edit field template is used for the Address property of
the Customer entity by default. The new property will be called Columns and allow you
to set the Columns property of the TextBox control created by this template. Following is
an extract from Text_Edit.ascx.cs that defines this property:
public partial class Text_EditField : FieldTemplateUserControl
{
public int Columns { get; set; }
}
There are several different ways to initialize the Columns property of the TextBox control
created by this field template. The simplest approach is to use an ASP.NET data binding
expression and modify the markup file, Text_Edit.ascx, as shown here:
 
Search WWH ::




Custom Search