private void LVLocations_CellEditStarting(object sender, CellEditEventArgs e) { var item = e.RowObject as LocationForDisplay; if (item != null && e.SubItemIndex == 1) { var bases = LocationPersistence.ListBases(); var control = new ComboBox(); int selectedIndex = -1; for (int i = 0; i < bases.Count; i++) { var b = bases[i]; control.Items.Add(new ComboBoxItem(b.Id, b.Name)); if (b.Id == item.LocationBaseId) { selectedIndex = i; } } control.SelectedIndex = selectedIndex; control.Width = e.Column.Width; control.Left = e.Control.Left; e.Control = control; } }
public Locations() { InitializeComponent(); var locations = LocationPersistence.ListBases(); LVLocations.VirtualMode = false; LVLocations.SetObjects(locations); }
public ActionResult Set(SetRequest rq) { if (rq == null) { throw new ArgumentNullException("rq"); } rq.Persist <LocationBase>(LocationBase.Delete); return(Json(SetRequest.FromPoco(LocationPersistence.ListBases()), JsonRequestBehavior.AllowGet)); }
// // GET: /Location/ public ActionResult Index() { return(View("~/Views/LocationBases.cshtml", SetRequest.FromPoco(LocationPersistence.ListBases()))); }