这个有点奇怪...我有一个使用Razor视图引擎的ASP.Net MVC 3 RC视图标记如下:
问题在于渲染时,P标签没有包含DIV!它的渲染结果如下:
<p>
<div class="editor-label">
@Html.LabelFor(model => model.Client.FirstName)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Client.FirstName) @Html.ValidationMessageFor(model => model.Client.FirstName)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.Client.LastName)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Client.LastName) @Html.ValidationMessageFor(model => model.Client.LastName)
</div>
</p>
问题在于渲染时,P标签没有包含DIV!它的渲染结果如下:
<p>
</p><div class="editor-label">
<label for="Client.FirstName">First Name</label>
</div>
<div class="editor-field">
<input class="text-box single-line" data-val="true" data-val-required="The First Name field is required." id="Client_FirstName" name="Client.FirstName" value="My FName" type="text"> <span class="field-validation-valid" data-valmsg-for="Client.FirstName" data-valmsg-replace="true"></span>
</div>
<div class="editor-label">
<label for="Client.LastName">Last Name</label>
</div>
<div class="editor-field">
<input class="text-box single-line" data-val="true" data-val-required="The Last Name field is required." id="Client_LastName" name="Client.LastName" value="My LName" type="text"> <span class="field-validation-valid" data-valmsg-for="Client.LastName" data-valmsg-replace="true"></span>
</div>
到底发生了什么?需要帮忙!