【发布时间】:2014-10-01 10:04:47
【问题描述】:
我可以添加 htmlAttributes 如下所示,并以 Html 呈现
@Html.EditorFor(Function(model) model.LastName, New With {Key .htmlAttributes = New With {Key .ng_model = "model.LastName"}})
但是当我在Views\Shared\EditorTemplates\Date.vbhtml 中添加了日期数据类型的自定义编辑器模板如下
@Code
Dim value = ""
If Not Model Is Nothing Then
value = String.Format("{0:d}", Model.Value.ToString("dd/MM/yyyy"))
End If
@Html.TextBox("", value, New With {Key .class = "datefield", Key .type = "text"})
End Code
我使用 EditorFor 和 htmlAttributes,然后 HtmlAttributes 没有呈现?
【问题讨论】:
-
发布渲染的内容而不是告诉它没有渲染可能是个好主意。
标签: asp.net-mvc razor asp.net-mvc-5.1