Databases Reference
In-Depth Information
FIGURE 1.12
Entity templates in Dynamic Data project.
As you might expect, entity templates are also a special type of ASP.NET user control.
Entity templates are located in the DynamicData/EntityTemplates folder of the web
project. Listing 1.11 shows code from the Default_Edit entity template.
LISTING 1.11
Default_Edit Entity Template (Markup)
<%@ Control Language=”C#” CodeBehind=”Default_Edit.ascx.cs”
Inherits=”WebApplication.DynamicData.EntityTemplates.Default_EditEntityTemplate”%>
<asp:EntityTemplate runat=”server” ID=”entityTemplate”>
<itemtemplate>
<tr class=”td”>
<td class=”DDLightHeader”>
<asp:Label runat=”server” OnInit=”Label_Init” />
</td>
<td>
<asp:DynamicControl runat=”server” Mode=”Edit”
OnInit=”DynamicControl_Init” />
</td>
</tr>
</itemtemplate>
</asp:EntityTemplate>
Inside of this user control, you have an EntityTemplate control, similar to the Repeater
control in ASP.NET WebForms. Its purpose is to provide a markup template with a Label
and a DynamicControl that will be rendered for each column in the table. Listing 1.12
shows the code-behind file where all this happens.
 
Search WWH ::




Custom Search