2
我試圖用Html.RenderPartial,但得到的錯誤:'使用' 必須以相匹配的結束 '結束使用'
'Using' must end with a matching 'End Using'.
查看:
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<mvc2Test.Models.Employee>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Create
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2>Create</h2>
<% Html.RenderPartial("ViewUserControl1"); %>
</asp:Content>
管窺:
<% using (Html.BeginForm()) {%>
<%: Html.ValidationSummary(true) %>
<fieldset>
<legend>Fields</legend>
<div class="editor-label">
<%: Html.LabelFor(model => model.EmployeeID) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(model => model.EmployeeID) %>
<%: Html.ValidationMessageFor(model => model.EmployeeID) %>
</div>
<div class="editor-label">
<%: Html.LabelFor(model => model.NationalIDNumber) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(model => model.NationalIDNumber) %>
<%: Html.ValidationMessageFor(model => model.NationalIDNumber) %>
</div>
<div class="editor-label">
<%: Html.LabelFor(model => model.ModifiedDate) %>
</div>
<div class="editor-field">
<%: Html.TextBoxFor(model => model.ModifiedDate, String.Format("{0:g}", Model.ModifiedDate)) %>
<%: Html.ValidationMessageFor(model => model.ModifiedDate) %>
</div>
<p>
<input type="submit" value="Save" />
</p>
</fieldset>
<% } %>