Fieldset在MVC 4剃须刀中不起作用
问题描述:
您好我有以下代码用于fieldset但无法正常工作
Hi I have the following code for fieldset but is not working
<fieldset>
<legend>@Html.Label("Caller Information","Caller Information", new { @class = "normal-label" })</legend>
<table class ="align-center">
<tr>
<td>@Html.Label("First Name: ", new { @class = "normal-label" })</td>
<td>@Html.Label("Surname : ", new { @class = "normal-label" })</td>
<td>@Html.Label("Client : ", new { @class = "normal-label" })</td>
<td>@Html.Label("Contact No:", new { @class = "normal-label" })</td>
<td>@Html.Label("Alternative No:", new { @class = "normal-label" })</td>
</tr>
<tr >
<td>@Html.TextBoxFor(model => model.CallerFirstName, null, new {@class = "CallerFirstName" })</td>
<td>@Html.TextBoxFor(model => model.CallerSurname, null, new {@class = "CallerSurname" })</td>
<td>@Html.TextBoxFor(model => model.Client, null, new {@class = "Client" })</td>
<td>@Html.TextBoxFor(model => model.Contact_Number, null, new {@class = "Contact_Number" })</td>
<td>@Html.TextBoxFor(model => model.Alternative_Contact, null, new {@class = "Alternative_Contact" })</td>
</tr>
</table>
</fieldset>
答
尝试放置一个简单的文本值而不是@Html.Label .....
例如:
Try to place a simple text value instead of @Html.Label .....
example:
<fieldset>
<legend>Product Details</legend>
@Html.HiddenFor(model => model.DetailItem.ProductId)
<div class="editor-label">
@Html.LabelFor(model => model.DetailItem.Name)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.DetailItem.Name)
@Html.ValidationMessageFor(model => model.DetailItem.Name)
</div>
<p>
<input type="submit" value="Save" />
</p>
</fieldset>