1
我試圖通過一個表格值「客戶ID」在MVC 4.使用Ajax.Actionlink誰能告訴我(i.e.dropdownlist選擇的值),我在做什麼錯在這裏?如何將選定的下拉列表值傳遞給MVC 4中的Ajax.ActionLink?
<div class="editor-label">
@Html.LabelFor(model => model.CustomerID, "Customer Name")
</div>
<div class="editor-field">
@Html.DropDownListFor(model => model.CustomerID, Model.CustomersList, "-- Select --")
@Html.ValidationMessageFor(model => model.CustomerID)
</div>
<div id="ApptsForSelectedDate">
@Ajax.ActionLink("Click here to view appointments",
"AppointmentsList",
new {id = Model.CustomerID},
new AjaxOptions
{
UpdateTargetId = "ApptsForSelectedDate",
HttpMethod = "GET",
InsertionMode = InsertionMode.Replace,
LoadingElementId = "progress"
}
)
</div>
<div id="progress">
<img src="../../Images/ajax-loader.gif" alt="loader image" />
</div>
我控制器的方法是這樣的:
public PartialViewResult AppointmentsList(int id)
{ ... }
謝謝Darrin!我試過你的代碼,它工作。你這麼好! – rk1962