我有以下模式:
Public Class BaseViewModel
Public Property Id as integer
Public Property Title As String
<DisplayName("Creation Date"), Required(), ScaffoldColumn(False)>
Public Property DateCreation As String
<DisplayName("Creation User"), Required(), ScaffoldColumn(False)>
Public Property UserCreation As String
<DisplayName("Modification Date"), ScaffoldColumn(False)>
Public Property DateModification As String
<DisplayName("Modification User"), ScaffoldColumn(False)>
Public Property UserModification As String
End Class
I ve产生了一个部分观点,称为“基地”号,其次为“超文本”
<div id="Detail-Item" class="hidden">
@Using Html.BeginForm("Save", "Agency", Nothing, FormMethod.Post, New With {.id = "Detail-form"})
@<fieldset>
<legend>Agency</legend>
@Html.ValidationSummary()
<div class="editor-label">
@Html.LabelFor(Function(model) model.Id):
</div>
<div class="editor-field">
@Html.TextBoxFor(Function(model) model.Id, New With {.class = "textbox-id input-key textbox-inactive", .data_field = "Id", .readonly = "readonly"})
@Html.ValidationMessageFor(Function(model) model.Id, "*")
</div>
<div class="editor-label">
@Html.LabelFor(Function(model) model.Title):
</div>
<div class="editor-field">
@Html.TextBoxFor(Function(model) model.Title, New With {.class = "textbox-name input-text focus", .data_field = "Title"})
@Html.ValidationMessageFor(Function(model) model.Title, "*")
</div>
<div class="hidden">
@Html.Hidden("UserCreation", String.Empty, New With {.class = "input-audituser", .data_field = "UserCreation"})
@Html.Hidden("UserModification", String.Empty, New With {.class = "input-audituser", .data_field = "UserModification"})
@Html.Hidden("DateCreation", String.Empty, New With {.class = "input-auditdate", .data_field = "DateCreation"})
@Html.Hidden("DateModification", String.Empty, New With {.class = "input-auditdate", .data_field = "DateModification"})
</div>
</fieldset>
End Using
</div>
用@html来表达这一看法。 EditForModel。 我的问题是,甚至使用Html的Im。 用于这些领域工作的Html生成的“需要”数据验证属性。
如果能避免这种情况?