我是新手,不知道为什么它没有到达我的控制器。我输入了一个 ID,没有任何反应,我在控制器中的断点没有被命中。我错过了什么?
控制器 ~/Controllers/AppointmentController.cs
[HttpPost]
public ActionResult Schedule(int id = 0)
{
if (Request.IsAjaxRequest())
{
Customer customer = _customerRepository.Find(id);
return PartialView("Schedule", customer);
}
return View();
}
查看 ~/Views/Appointment/Schedule.cshtml
@model Customer
@{
ViewBag.Title = "Schedule";
}
<h2>Schedule</h2>
@using (Ajax.BeginForm("Schedule", "Appointment",
new AjaxOptions()
{
HttpMethod = "POST",
InsertionMode = InsertionMode.Replace,
UpdateTargetId = "Customer"
}))
{
<label>ID Search</label>
<input type="search" name="customerSearch" placeholder="ID" />
<input type="submit" value="Continue" />
}
<div id="Customer">
@Html.Partial("~/Views/Customer/_Customers.cshtml", Model)
</div>