Databases Reference
In-Depth Information
Notice the call to the GetRequestMetaTable method of the DynamicDataRouteHandler
class. This method extracts the table name from the URL and finds the matching table in
the default MetaModel . Having obtained the required MetaTable , this code associates it
with the GridView control and configures the EntityDataSource .
NOTE
Setting the EntityTypeFilter property as opposed to the EntitySetName property of
the EntityDataSource control allows this code to work correctly not only with the
simple, table-per-type mapping that has been used thus far in the Northwind sample. It
also supports the more advanced table mappings offered by the Entity Framework,
which are discussed in Chapter 2, “Entity Framework.”
The List page template also uses the DynamicHyperLink control in a databound GridView :
<asp:TemplateField>
<ItemTemplate>
<asp:DynamicHyperLink runat=”server” Action=”Edit” Text=”Edit” />&nbsp;
<asp:LinkButton runat=”server” CommandName=”Delete” Text=”Delete” />&nbsp;
<asp:DynamicHyperLink runat=”server” Text=”Details” />
</ItemTemplate>
</asp:TemplateField>
When bound to a single entity object, the DynamicHyperLink generates a URL with addi-
tional parameters. Action property of the DynamicHyperLink class specifies the name of
the page template, Edit in this example. When bound to a Product with the primary
key column (ProductID) equal to one, this control generates a URL that looks like
http://localhost/Products/Edit.aspx?ProductID=1 . Figure 1.21 shows the web page
displayed by this link.
 
Search WWH ::




Custom Search