Databases Reference
In-Depth Information
actually takes advantage of this to disable user interface for the children columns in Insert
mode. If you open the Children_Insert.ascx field template, you see that it is empty. If
this empty field template did not exist, Children.ascx would be used in its place, causing
runtime errors because this template is not prepared to handle the scenario when the
parent row does not exist.
Field Template Lookup Algorithm
Although the lookup rules for field templates might seem complex at a first, they are
based on common-sense logic, and when you understand the idea behind them, the
results will feel intuitive. Just remember that Dynamic Data tries to choose the most
specific field template based on the column definition and control mode, and if such a
field template does not exist, it gradually relaxes the matching rules until it finds a match
or reports an error. The resulting behavior allows you to easily add new field templates
where unique behavior is required to support a particular column type while allowing you
to reuse existing templates with common behavior such as displaying read-only field values.
Figure 3.4 shows the actual algorithm used by Dynamic Data. FieldTemplateFactory , a
special class defined in the System.Web.DynamicData namespace, performs this task.
FIGURE 3.4 Field template lookup algorithm.
 
Search WWH ::




Custom Search