2

I am just starting with mvc3 and razor having done some mvc2 in the past and something puzzles me.

I am trying to render a unordered list from a collection in my model and have done so successfully. using this code.

In my view:

@using (Html.BeginForm())
{
    <ul>
        @Html.DisplayFor( m => m.SomeThings)
    </ul>
}

In my DisplayTemplate:

@model MyNamespace.Models.SomeType               
<li>
    <a href="@Url.Content(String.Format("~/SomeUrl/{0}", @Html.DisplayFor(x => x.UrlText)))">@Html.DisplayFor(x => x.Name)</a>
</li>

This all works and is fine but I've noticed that the display template fails XHTML 1.0 Transitional validation and thus generates a warning (Element 'li' cannot be nested within element li') this is annoying as its not nested but is there anyway to stop this error ? Or is it something i must put up with ?

krystan honour
  • 6,523
  • 3
  • 36
  • 63
  • 4
    Either you are trying to validate a razor template (which isn't XHTML, so you shouldn't try to validate it as such) or you need to show us the XHTML you are generating from it that is failing validation. – Quentin May 18 '12 at 17:06
  • looks like resharper is trying to do this, anyone know how to stop it or do i report a bug in resharper its definately NOT embedding
  • tags
  • –  May 18 '12 at 17:18