It seems that controls like BoundField only work inside data binding containers like e.g. a GridView, where there is repeating data. I would like to know how to code something like a BoundField that will work e.g. inside the ItemTemplate of a data bound FormView. Just look how much more readable the MyFormViewBoundField is below compared to the raw template way of doing this.
The current way of doing it:
<ItemTemplate>
<div class="span-12 last">
<dl class="name-value">
<dt>Property Type</dt>
<dd><%# Eval("property_type_full") %></dd>
</dl>
</div>
</ItemTemplate>
Compared to what I wish to do:
<ItemTemplate>
<div class="span-12 last">
<mystuff:MyFormViewBoundField LabelText="PropertyType" DataValueField="property_type_full" />
</div>
</ItemTemplate>
You can do this with a simple server Control and customise as required.
Obviously adding support for ViewState or design-time support requires more work, but that’s the basics.