private void BindControls(Entities.TourCollection tours) { this.Tours = tours; this.Tours.ListChanged += new ListChangedEventHandler(Tours_ListChanged); this.ctrlManager = new FormControlManager(this.flpTours, tours); this.ctrlManager.CreateControl = CreateTour; this.ctrlManager.FindControl = TourFindControl; this.ctrlManager.ListContainsControl = ListContainsTour; }
private void BindControls(Entities.Tour tour) { Detach(); this.tour = tour; Attach(); this.ctrlManager = new FormControlManager(this.pnlGroups, tour.Groups); this.ctrlManager.CreateControl = CreateTourGroup; this.ctrlManager.FindControl = TourGroupFindControl; this.ctrlManager.ListContainsControl = ListContainsTourGroup; UpdateData(true); }
private void BindControls() { if (this.group == null || this.tour == null) { return; } this.ctrlManager = new FormControlManager(this.flpMain, this.Group.Services); this.ctrlManager.CreateControl = CreateService; this.ctrlManager.FindControl = ServiceFindControl; this.ctrlManager.ListContainsControl = ListContainsService; UpdateData(); }
public override object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) { ValueProviderResult formIdResult = bindingContext.ValueProvider.GetValue("FormId"); if (formIdResult == null) return null; long formId = long.Parse(formIdResult.AttemptedValue); ValueProviderResult controlIdResult = bindingContext.ValueProvider.GetValue(bindingContext.ModelName + ".Id"); if (controlIdResult == null) return null; int controlId = int.Parse(controlIdResult.AttemptedValue); FormViewModel form; ControlViewModel model = FormControlManager.GetControl(formId, controlId, out form); if (model == null) return null; bindingContext.ModelMetadata = ModelMetadataProviders.Current.GetMetadataForType(() => model, model.GetType()); return base.BindModel(controllerContext, bindingContext); }