Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest May 16th, 2018 91 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. public class ForkliftViewModel
  2. {
  3.     public Forklift Forklift { get; set; }
  4.     public Manufacturer Manufacturer { get; set; }
  5.     public HashSet<Manufacturer> ManufacturerList = Manufacturer.GetForkliftManufacturers();
  6.     public IEnumerable<SelectListItem> ManufacturerSelectList { get; set; }
  7. }
  8.    
  9. public ActionResult Edit(int id)
  10. {
  11.     ForkliftViewModel FVM = new ForkliftViewModel();
  12.  
  13.     FVM.Forklift = Forklift.GetForkliftByID(id);
  14.  
  15.     FVM.ManufacturerSelectList = new SelectList(FVM.ManufacturerList, "ManufacturerID", "Name");
  16.  
  17.     return View(FVM);
  18. }
  19.    
  20. @model MyApp.Models.ViewModels.ForkliftViewModel
  21.  
  22. ...
  23.  
  24. @Html.LabelFor(model => model.Forklift.ManufacturerID, htmlAttributes: new { @class = "control-label col-md-2" })
  25.  
  26. <div class="col-md-12">
  27.     @Html.DropDownListFor(model => model.Forklift.ManufacturerID, Model.ManufacturerSelectList, "-- Select Manufacturer --", new { @class = "form-control" })
  28.     @Html.ValidationMessageFor(model => model.Forklift.ManufacturerID, "", new { @class = "text-danger" })
  29. </div>
  30.    
  31. @Html.DropDownListFor(model => model.Forklift.ManufacturerID, new SelectList(Model.ManufacturerList, "ManufacturerID", "Name"), "-- Select Manufacturer --", new { @class = "form-control" })
  32.    
  33. public class Manufacturer
  34. {
  35.     public int ManufacturerID { get; set; }
  36.     public string Name { get; set; }
  37.  
  38.     ...
  39.  
  40. }
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