开发者

Anyone had success with EditorFor Templates using FluentHtml?

I know it's a long shot, but i wondered if anyone has had any success with using FluentHtml inside an editorFor Template.

Specifically, getting the prefixes to work so that the viewmodel binds back when submitted.

<%: Html.EditorFor(model => model.Client, "ClientTemplate", new { editing = false })%>

The above for example would prefix all the form html input (Name's and Id's) with Client, so that it will bind back correctly. But when using fluent this is not the case.

An example of some Fluent Html.

<%= this.TextBox(model => model.Name)
         .Disabled(Model.IsDisabled)
         .Class("large")%>

At the moment, i am considering setting the Id manually with the p开发者_运维百科refix... but this is not ideal.

I could also remove the fluent Html but I then lose the ability to set "disabled" as nicely.


If I understand what you are doing, this should work. In the markup, add:

<%this.HtmlNamePrefix = "Client"%>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜