RazorGenerator not processing Html.EditorFor or Html.BeginForm

Jan 13, 2012 at 11:59 AM

I have the following razor code:

 

<form id="logon" action="/security/dev" method="get">
    @Html.AntiForgeryToken()
    @Html.EditorFor(x => x.UserName)
    @Html.EditorFor(x => x.Password)
    <input type="submit" value="Login" name="Login" />
    <input type="submit" value="Cancel" name="Cancel" />
</form>

 

when getting the precompiled version to output the generated html I get the following:

<form id="logon" action="/security/dev" method="get">
    <input name="__RequestVerificationToken" type="hidden" value="vTyswnqonYMzGeewLrLSJ9XySz1A0PR0nvyVu58458J/nftXtxBPIVoQEdfr3MzEYPDLBPcGvXtMkOTujsou/x3eJVfdt2YSJgxUfu6AxMLj23kTwUNQo7X8ec7twsbt8U2BdogpHy0fSGq1nMljlukM9fGZ/770JLijcpJXx4o=" />
        /* EditorTemplates/String */

        /* EditorTemplates/Password */

        <input type="submit" value="Login" name="Login" />
        <input type="submit" value="Cancel" name="Cancel" />
  </form>
Anyone have any idea why it would do that?

Coordinator
Jan 13, 2012 at 3:43 PM

This is discussed in http://blog.davidebbo.com/2011/06/unit-test-your-mvc-views-using-razor.html. Look at the "What about partial views?" section.

thanks,
David