我是 MVC 的新手,我曾一度被困在项目中,我想检查批处理的可用性,我正在使用下拉列表,它由批处理表填充。
我的问题是,当我同时从下拉列表中选择一个批处理时,它会给出批处理可用或不可用的消息。
批处理表结构为: BatchID BachName TotalSeat AvailableSeat 01 L1 50 40 02 L2 20 20
我不知道如何完成这个任务。
最佳答案
您可以从这个 link 中看到不同的解决方案:
@using (Html.BeginForm("Method", "YourController")) {
@Html.DropDownList("Id", ViewBag.DropDownCollection as SelectList, "--pick--", new {
title = "Pick Batch",
onchange = "submit();"
});
}
ActionResult
public ActionResult Method(string Id)
{
//do the logic here
}
关于asp.net-mvc - 如何在选定索引更改时将下拉选择的值传递给 Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16580293/