Databases Reference
In-Depth Information
Text_Edit
The Text_Edit.ascx field template is used for string columns in Edit and Insert modes.
It includes a TextBox control, accompanied by a RequiredFieldValidator , used to enforce
values for columns marked with the RequiredAttribute ; a RegularExpressionValidator ,
used to enforce regular expression patterns for columns marked with the
RegularExpressionAttribute ; and a DynamicValidator , used to enforce all other valida-
tion attributes applied to the column.
Url
The Url.ascx field template is used for columns marked with the DataType(DataType.Url)
attribute. It contains a HyperLink control that displays the field value as a link in the
generated HTML. The “http://” scheme is automatically added to the URL unless the
field value already contains it. Only HTTP and HTTPS schemes are recognized automati-
cally. Although this field template does not require the column type to be only String ,
the field value converted to string must be a valid URL for the generated hyperlink to
work correctly.
Summary
A field template is a special type of ASP.NET user control that inherits from the
FieldTemplateUserControl base class provided by Dynamic Data. Multiple columns can
reuse the same field template based on its compatibility with the column type and control
mode. Changing a single field template automatically affects the user interface generated
for all matching columns in the data model. Dynamic Data project template comes with a
reasonable number of field templates that allow developers to create working web applica-
tions for many data types out of the box. Developers can easily modify the default field
templates as well as add new ones to meet specific requirements of their projects.
Dynamic Data supports separate templates for Read-only, Edit, and Insert modes.
Although a single template can support all three modes and programmatically display
different versions of child controls, separating this logic into different templates helps to
keep them simple and lightweight. Dynamic Data uses common-sense logic to find the
best matching field template based on the column type and required control mode. If the
most specific template does not exist, Dynamic Data gradually relaxes the matching rules
and tries to find templates for a more generic column type and control mode.
 
 
Search WWH ::




Custom Search