Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/multithreading/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net mvc 1视图中的多个液滴列表过滤器_Asp.net Mvc - Fatal编程技术网

Asp.net mvc 1视图中的多个液滴列表过滤器

Asp.net mvc 1视图中的多个液滴列表过滤器,asp.net-mvc,Asp.net Mvc,我有一个视图,它有一个过滤器,在更改时过滤视图。我的问题是如何添加第二个水滴列表和第三个水滴列表。我不知道如何开始这个过程。以下是我目前使用1所做的工作 Branch: @Html.DropDownList("Branch", ViewBag.Branches as SelectList, "All Locations") 在我的控制器中: 公共操作结果分支(字符串分支) { ViewBag.BranchName=分支 IEnumerable<Employee&

我有一个视图,它有一个过滤器,在更改时过滤视图。我的问题是如何添加第二个水滴列表和第三个水滴列表。我不知道如何开始这个过程。以下是我目前使用1所做的工作

    Branch: @Html.DropDownList("Branch", ViewBag.Branches as SelectList, "All Locations")

在我的控制器中: 公共操作结果分支(字符串分支) { ViewBag.BranchName=分支

        IEnumerable<Employee> employees = from m in db.Employees
                                          where m.Branch == Branch || Branch == null || Branch == ""
                                          select m;
        IEnumerable<Branch> branches = from c in bCon.Branches
                                         where c.BranchName == Branch
                                         select c;

        var viewModel = new BranchViewModel()
        {
            BranchName = Branch,
            Employees = employees.ToList(),
            Branches = branches.ToList()
        };

        return View(viewModel);

    }
IEnumerable employees=从m开始,单位为db.employees
其中m.Branch==Branch | | Branch==null | | Branch==“”
选择m;
IEnumerable branchs=来自bCon.branchs中的c
其中c.BranchName==分支
选择c;
var viewModel=new BranchViewModel()
{
BranchName=分支,
Employees=Employees.ToList(),
Branchs=Branchs.ToList()
};
返回视图(viewModel);
}
问候,,
SEB

您只需在razor中使用@Model即可将viewModel发送到View

Branch: @Html.DropDownList("Branch", @Model.Branches as SelectList, "All Locations")
Employees : @Html.DropDownList("Branch", @Model.Employees as SelectList, "All Locations")
Branch: @Html.DropDownList("Branch", @Model.Branches as SelectList, "All Locations")
Employees : @Html.DropDownList("Branch", @Model.Employees as SelectList, "All Locations")