Databases Reference
In-Depth Information
protected void DynamicControl_Init(object sender, EventArgs e)
{
((UnleashedControl)sender).DataField = this.currentColumn.Name;
}
private PlaceHolder FindGroupPlaceHolder(MetaColumn column)
{
PlaceHolder placeHolder = null;
var display = column.Attributes.OfType<DisplayAttribute>().FirstOrDefault();
if (display != null && !string.IsNullOrWhiteSpace(display.GroupName))
placeHolder = (PlaceHolder)this.FindControl(display.GroupName);
return placeHolder ?? this.left;
}
}
}
The
FindGroupPlaceHolder
method tries to find a
DisplayAttribute
applied to the entity
property described by the
MetaColumn
object it receives. If the
DisplayAttribute
is found
and has the
GroupName
property specified, it calls the
FindControl
method inherited from
the ASP.NET's
Control
base class to find the
PlaceHolder
with the matching name. If the
entity property does not have a
GroupName
annotation or if the PlaceHolder with the speci-
fied name could not be found, the “
left
”
PlaceHolder
is returned by default. In other
words, unless you specify otherwise, the TwoColumn entity template displays controls on
the left side of the page.
Figure 11.8 shows how the Employee details page can look when the
EntityUIHintAttribute
is applied to the entity class and the
GroupName
annotation is specified for the appropriate
entity properties.