Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public ActionResult Index(string FilialType)
- {
- var FilialQry = from d in db.Probs
- orderby d.DEP.dep_name
- select d.DEP.dep_name;
- var FilialLst = new List<string>();
- FilialLst.AddRange(FilialQry.Distinct());
- ViewBag.FilialType= new SelectList(FilialLst);
- var probs = from s in db.Probs
- select s;
- if (!string.IsNullOrEmpty(FilialType))
- {
- probs= probs.Where(x => x.DEP.dep_name == FilialType);
- }
- return View(probs);
- }
- @using (Html.BeginForm("Index", "Probs", FormMethod.Get))
- {
- <p>
- Выберите из списка: @Html.DropDownList("FilialType", String.Empty) <!-- вместо String.Empty также было значение "All" -->
- <input type="submit" value="Поиск" />
- </p>
- }
Add Comment
Please, Sign In to add comment