C# 为什么Ajax.BeginFom不退出?
我已经安装了Microsoft.jQuery.Unobtrusive.Ajax。 它说:“Ajax”这个名称在当前上下文中不存在 控制器类:C# 为什么Ajax.BeginFom不退出?,c#,ajax,asp.net-mvc,asp.net-core,C#,Ajax,Asp.net Mvc,Asp.net Core,我已经安装了Microsoft.jQuery.Unobtrusive.Ajax。 它说:“Ajax”这个名称在当前上下文中不存在 控制器类: public ActionResult SimpleInterest() { return View(); } 以及以下观点: <fieldset> <legend>Calculate Simple Interest</legend> @using (Ajax.BeginForm(&q
public ActionResult SimpleInterest()
{
return View();
}
以及以下观点:
<fieldset>
<legend>Calculate Simple Interest</legend>
@using (Ajax.BeginForm("SimpleInterest", "Employee", new AjaxOptions { UpdateTargetId = "divInterestDeatils" }))
{
<div id="divInterestDeatils"></div>
<ol>
<li>
@Html.Label("Amount")
@Html.TextBox("txtAmount")
</li>
<li>
@Html.Label("Rate")
@Html.TextBox("txtRate")
</li>
<li>
@Html.Label("Year")
@Html.TextBox("txtYear")
</li>
</ol>
<button>Calculate</button>
}
计算单利
@使用(Ajax.BeginForm(“SimpleInterest”、“Employee”、新的AjaxOptions{UpdateTargetId=“divInterestDeatils”}))
{
@Html.Label(“金额”)
@Html.TextBox(“txtAmount”)
@Html.Label(“费率”)
@Html.TextBox(“txtRate”)
@Html.Label(“年”)
@Html.TextBox(“txtYear”)
算计
}
您需要安装AspNet.Mvc nuget软件包
在NuGet Package Manager控制台中运行
安装包Microsoft.AspNet.Mvc
,或者使用NuGet Package Manager进行安装。它应该可以解决您的问题我安装了它,并将@using System.Web.Mvc.Ajax放到视图中,AjaxOptions现在可以正常工作了,但是Ajax.BeginForm仍然不起作用…@WolfAlexander卸载并重新安装程序包它会起作用的