public override ActionResult BuildEditor(Controller controller, WorkContext workContext, ControlFormResult <IWidget> form) { var listService = workContext.Resolve <IListService>(); var list = listService.GetRecords().OrderBy(x => x.Name).ToDictionary(x => x.Id, x => x.Name); form.RegisterExternalDataSource("ListId", list); form.RegisterCascadingDropDownDataSource("CategoryId", new ControlCascadingDropDownOptions { SourceUrl = controller.Url.Action("EditorCallback"), Command = "GetCategories" }); return(form); }
public ControlForm <TModel> RegisterCascadingDropDownDataSource <TValue>(Expression <Func <TModel, TValue> > expression, string sourceUrl) { model.RegisterCascadingDropDownDataSource(expression, sourceUrl); return(this); }