C# ';使用';必须以匹配的';结束使用';
我试图使用Html.RenderPartial,但出现错误: “Using”必须以匹配的“end Using”结尾 视图:C# ';使用';必须以匹配的';结束使用';,c#,.net,asp.net-mvc-2,C#,.net,Asp.net Mvc 2,我试图使用Html.RenderPartial,但出现错误: “Using”必须以匹配的“end Using”结尾 视图: 创造 创造 局部视图: <% using (Html.BeginForm()) {%> <%: Html.ValidationSummary(true) %> <fieldset> <legend>Fields</legend> <div class="
创造
创造
局部视图:
<% 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>
<% } %>
领域
model.EmployeeID)%>
model.EmployeeID)%>
model.EmployeeID)%>
型号(国家编号)%>
型号(国家编号)%>
型号(国家编号)%>
model.ModifiedDate)%%>
model.ModifiedDate,String.Format(“{0:g}”,model.ModifiedDate))%>
model.ModifiedDate)%%>
错误消息表明代码被解析为VB,而不是C。您是否无意中为部分视图指定了错误的语言?我知道了,我忘了在视图顶部放置这行代码:
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<mvc2Test.Models.Employee>" %>
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<mvc2Test.Models.Employee>" %>