As I mentioned in my comment, you can directly check the value of m[i].Type :
@if (m[i].Type == "Info_Text") { <td></td> } else { <td>@Html.EditorFor(m => m[i].Answer)</td> }
The reason you won't test the DisplayFor value is because it returns an MvcHtmlString , not just a type of type string or int . You could do something like this if you ever find the need to compare with DisplayFor some day (and hopefully this will simplify everything):
@if (Html.DisplayFor(m => m[i].Type) == new MvcHtmlString("Info_Text"))
Since you are participating in the MVC learning process, you might also be wondering how you can configure the EditorFor to do this automatically: http://www.hanselman.com/blog/ASPNETMVCDisplayTemplateAndEditorTemplatesForEntityFrameworkDbGeographySpatialTypes.aspx
source share