如何以表格格式放置代码

如何以表格格式放置代码

本文介绍了如何以表格格式放置代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<% using (Html.BeginForm()) { %>
    <%: Html.ValidationSummary(true) %>
    <fieldset>
        <legend>EMP</legend>

       <table>
        <div class="editor-label">
            <%: Html.LabelFor(model => model.FirstName) %>

       <%-- </div>--%>

        <%--<div class="editor-field">--%>
            <%: Html.EditorFor(model => model.FirstName) %>
            <%: Html.ValidationMessageFor(model => model.FirstName) %>
            </tr>
        </div>
      <br />

        <div class="editor-label">
            <%: Html.LabelFor(model => model.LastName) %>
      <%--  </div>--%>
        <%--<div class="editor-field">--%>
            <%: Html.EditorFor(model => model.LastName) %>
            <%: Html.ValidationMessageFor(model => model.LastName) %>
        </div>
      <br />
        <div class="editor-label">
            <%: Html.LabelFor(model => model.Phone) %>
       <%-- </div>--%>
        <%--<div class="editor-field">--%>
            <%: Html.EditorFor(model => model.Phone) %>
            <%: Html.ValidationMessageFor(model => model.Phone) %>
        </div>
      <br />

        <div class="editor-label">
            <%: Html.LabelFor(model => model.Email) %>
        <%--</div>--%>
        <%--<div class="editor-field">--%>
            <%: Html.EditorFor(model => model.Email) %>
            <%: Html.ValidationMessageFor(model => model.Email) %>
        </div>
     </table>

推荐答案

@{
	using (Html.BeginForm())
	{
		Html.ValidationSummary(true);

	<fieldset>
		<legend>EMP</legend>
		<table>
			<tr>
				<td>
					<div class="editor-label">@Html.LabelFor(model => model.FirstName)</div>
				</td>
				<td>
					<div class="editor-field">
						@Html.EditorFor(model => model.FirstName)
						@Html.ValidationMessageFor(model => model.FirstName)
					</div>
				</td>
			</tr>
			<tr>
				<td>
					<div class="editor-label">@Html.LabelFor(model => model.LastName)</div>
				</td>
				<td>
					<div class="editor-field">
						@Html.EditorFor(model => model.LastName)
						@Html.ValidationMessageFor(model => model.LastName)
					</div>
				</td>
			</tr>
			<tr>
				<td>
					<div class="editor-label">@Html.LabelFor(model => model.Phone)</div>
				</td>
				<td>
					<div class="editor-field">
						@Html.EditorFor(model => model.Phone)
						@Html.ValidationMessageFor(model => model.Phone)
					</div>
				</td>
			</tr>
			<tr>
				<td>
					<div class="editor-label">@Html.LabelFor(model => model.Email)</div>
				</td>
				<td>
					<div class="editor-field">
            @Html.EditorFor(model => model.Email)
						@Html.ValidationMessageFor(model => model.Email)
					</div>
				</td>
			</tr>
		</table>
	</fieldset>
	}
}


希望对您有所帮助


Hope this helps, regards


这篇关于如何以表格格式放置代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-23 08:24