我为多行文字数据类型创建了一个EditorTemplate。
但是在渲染页面之后,ASP会添加额外的HTML代码。我该如何防止这种情况?
我的多线文字编辑器模板是:
@model string
<div class="control-group">
@Html.LabelFor(x => x, new {@class="control-label col-md-2"})
<div class="col-md-10">
@Html.TextAreaFor(x => x , new { @class="form-control"})
@Html.ValidationMessageFor(x => x, "", new { @class = "text-danger" })
</div>
</div>
生成的代码是:
<div class="editor-label">
<label for="Description">ِDescription</label>
</div>
<div class="editor-field">
/*Start My template*/
<div class="control-group">
<label class="control-label col-md-2" for="Description">Description</label>
<div class="col-md-10">
<textarea class="form-control" cols="20" id="Description" name="Description" rows="2"></textarea>
<span class="field-validation-valid text-danger" data-valmsg-for="Description" data-valmsg-replace="true"></span>
</div>
/*End of template*/
</div>
<span class="field-validation-valid" data-valmsg-for="Description" data-valmsg-replace="true"></span></div>