Databases Reference
In-Depth Information
In the
Details
page template, the Edit and Delete links are implemented as
DynamicHyperLink
controls inside of the
ItemTemplate
of a
FormView
control:
<asp:FormView runat=”server” ID=”formView” DataSourceID=”dataSource”>
<ItemTemplate>
<unl:UnleashedEntity runat=”server” />
<tr>
<td colspan=”2”>
<asp:DynamicHyperLink runat=”server” Action=”Edit” Text=”Edit” />
<asp:DynamicHyperLink runat=”server” Action=”Delete” Text=”Delete”/>
<a href=”<%= this.table.ListActionPath %>”>Show all items</a>
</td>
</tr>
</ItemTemplate>
</asp:FormView>
Just like with the Edit and Delete link controls in the List page template, the Details
template needs to implement
Init
event handlers and call, respectively, the
CanUpdate
and
CanDelete
methods of the
MetaTable
class and set the controls'
Visible
property
based on the values they return. The code is identical to the
EditLink_Edit
event handler
example discussed earlier for the List page.
Figure 14.7 shows how the trimmed Details page looks when the current user does not
have the update and delete permissions. Notice that the Edit and Delete links that
normally appear at the bottom of the form are not displayed.
FIGURE 14.7
Product Details page hiding inaccessible actions.