I'm building a table of data like this
<% foreach (var person in Model.People)
{
%>
<tr>
<td><%= Html.ActionLink(accessory.Name, "EditPerson") %></td>
<td><%= Html.DisplayFor(c => person.Name) %></td>
<td><%= Html.DisplayFor(c => person.Age) %></td>
<td><%= Html.DisplayFor(c => person.Budget)%></td>
</tr>
<%} %>
I've created templates to override the defaults following Brad Wilson's tutorial:
<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %>
<script runat="server">
protected override void OnInit(EventArgs e) {
base.OnInit(e);
if (ViewData.ModelMetadata.HideSurroundingHtml) {
TablePlaceholder.Visible = false;
}
else {
Controls.Remove(Data);
DataPlaceholder.Controls.Add(Data);
}
}
</script>
<asp:ContentPlaceHolder runat="server" id="Data" />
<asp:PlaceHolder runat="server" id="TablePlaceholder">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="width: 10em;">
<div class="display-label" style="text-align: right;">
<asp:ContentPlaceHolder runat="server" id="Label">
<%= ViewData.ModelMetadata.GetDisplayName() %>
</asp:ContentPlaceHolder>
</div>
</td>
<td>
<div class="display-field">
<asp:PlaceHolder runat="server" id="DataPlaceholder" />
</div>
</td>
</tr>
</table>
</asp:PlaceHolder>
When rendering the table I don't want to display the surrounding HTML, but I don't have a clue how to set the HideSurroundingHtml value?