I'm working through the NerdDinner MVC tutorial and came across this and was wondering about.
On page 62 of the pdf they have the following:
<asp:Content ID="Main" ContentPlaceHolderID="MainContent" runat="server">
<h2>Upcoming Dinners</h2>
<ul>
<% foreach (var dinner in Model) { %>
<li>
<a href="/Dinners/Details/<%=dinner.DinnerID %>">
<%= Html.Encode(dinner.Title) %>
</a>
on
<%= Html.Encode(dinner.EventDate.ToShortDateString())%>
@
<%= Html.Encode(dinner.EventDate.ToShortTimeString())%>
</li>
<% } %>
</ul>
</asp:Content>
They then state that instead of using an <a>
tag that you can use the Html helper like so:
<%= Html.ActionLink(dinner.Title, "Details", new { id=dinner.DinnerID }) %>
The question is: Isn't it still important to Html.Encode the dinner.Title from the Model when using this approach? If not, why not? If so, is there a way to use the Html.ActionLink and still use Html.Encode?