daily pastebin goal
50%
SHARE
TWEET

Untitled

a guest Dec 10th, 2018 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public ActionResult Index(string FilialType)
  2. {
  3.     var FilialQry = from d in db.Probs
  4.                 orderby d.DEP.dep_name
  5.                 select d.DEP.dep_name;
  6.     var FilialLst = new List<string>();
  7.  
  8.     FilialLst.AddRange(FilialQry.Distinct());
  9.     ViewBag.FilialType= new SelectList(FilialLst);
  10.  
  11.     var probs = from s in db.Probs
  12.                 select s;
  13.  
  14.     if (!string.IsNullOrEmpty(FilialType))
  15.     {
  16.         probs= probs.Where(x => x.DEP.dep_name == FilialType);
  17.     }
  18.  
  19.     return View(probs);
  20. }
  21.    
  22. @using (Html.BeginForm("Index", "Probs", FormMethod.Get))
  23. {
  24. <p>
  25.     Выберите из списка: @Html.DropDownList("FilialType", String.Empty) <!-- вместо String.Empty также было значение "All" -->        
  26.     <input type="submit" value="Поиск" />
  27. </p>    
  28. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top