I would definitely move this to ViewHelper. This is due to the fact that as soon as you start writing presentation logic in representations - aspx files, you start creating "soup soup", which reduces the comprehensibility of the code and, therefore, increases the cost of maintenance.
Another advantage of using ViewHelpers to encapsulate your view logic is that it also makes your application more flexible for unit testing. Therefore, given your code above, I would use it in ViewHelper, for example,
using System.Linq; using System.Web.Mvc; using System; using System.Text; using System.Web.Mvc.Html;
Subsequently, somewhere in your view, I would call this helper method this way,
<% Html.ShowContactInfo(Model); %>
This method leads to the fact that looks that avoid the "soup tag" are more convenient to maintain and are immensely verified by the unit.
source share