有人使用 FluentHtml 成功使用 EditorFor Templates 吗?
我知道这是一个漫长的过程,但我想知道是否有人成功使用 FluentHtml在 editorFor Template 内。
具体来说,让前缀起作用,以便视图模型在提交时绑定回来。
<%: Html.EditorFor(model => model.Client, "ClientTemplate", new { editing = false })%>
例如,上面的示例将为所有表单 html 输入(名称和 ID)添加 Client 前缀,以便它将正确绑定回来。但当使用 flutter 时,情况并非如此。
一些 Fluent Html 的示例。
<%= this.TextBox(model => model.Name)
.Disabled(Model.IsDisabled)
.Class("large")%>
目前,我正在考虑使用前缀手动设置 Id...但这并不理想。
我也可以删除流畅的 Html,但随后我也失去了设置“禁用”的能力。
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 prefix... but this is not ideal.
I could also remove the fluent Html but I then lose the ability to set "disabled" as nicely.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我明白你在做什么,这应该可行。在标记中,添加:
If I understand what you are doing, this should work. In the markup, add: