Databases Reference
In-Depth Information
[Display(Name = “Street”)]
public object Address { get; set; }
[Display(Name = “State”)]
public object Region { get; set; }
[Display(Name = “Zip”)]
public object PostalCode { get; set; }
[ScaffoldColumn(false)]
public object HomePage { get; set; }
}
}
}
Edit and Insert Entity Templates
In addition to the Read-only entity templates that have been discussed so far, Dynamic
Data also supports entity templates in Edit and Insert modes. Consider the FormView
control in Listing 4.13, which in addition to the Read-only ItemTemplate used earlier also
defines the EditItemTemplate and InsertItemTemplate sections. All three of these
sections use the DynamicEntity control to load an appropriate entity template dynami-
cally, based on the MetaTable associated with the FormView and the Mode property, which
can be Insert , Edit , or ReadOnly (default).
LISTING 4.13
Customer Information Page with Support for Edit and Insert Modes
<%@ Page Language=”C#”
MasterPageFile=”~/Site.master” CodeBehind=”SamplePage.aspx.cs”
Inherits=”WebApplication.Samples.Ch04.EditTemplates.SamplePage” %>
<asp:Content runat=”server” ContentPlaceHolderID=”main”>
<asp:ValidationSummary runat=”server” />
<asp:FormView ID=”form” runat=”server” DataSourceID=”dataSource”
DataKeyNames=”CustomerID”>
<ItemTemplate>
<asp:DynamicEntity runat=”server” />
<tr><td>
<asp:LinkButton runat=”server” CommandName=”Edit” Text=”Edit” />
<asp:LinkButton runat=”server” CommandName=”New” Text=”New” />
</td></tr>
</ItemTemplate>
<InsertItemTemplate>
<asp:DynamicEntity runat=”server” Mode=”Insert”/>
 
 
Search WWH ::




Custom Search