private void BindLayouts() { _Layouts = LayoutDataSource.LoadAll(); LayoutsGrid.DataBind(); // INIT DEFAULTS StoreSettingsManager settings = AbleContext.Current.Store.Settings; WebpagesDefault.DataSource = _Layouts; WebpagesDefault.DataBind(); if (!string.IsNullOrEmpty(settings.WebpagesDefaultLayout)) { SelectItem(WebpagesDefault, settings.WebpagesDefaultLayout); } CategoriesDefault.DataSource = _Layouts; CategoriesDefault.DataBind(); if (!string.IsNullOrEmpty(settings.CategoriesDefaultLayout)) { SelectItem(CategoriesDefault, settings.CategoriesDefaultLayout); } ProductsDefault.DataSource = _Layouts; ProductsDefault.DataBind(); if (!string.IsNullOrEmpty(settings.ProductsDefaultLayout)) { SelectItem(ProductsDefault, settings.ProductsDefaultLayout); } }
protected void UpdateDefaultsButton_Click(object sender, EventArgs e) { // SAVE SETTINGS StoreSettingsManager settings = AbleContext.Current.Store.Settings; settings.WebpagesDefaultLayout = WebpagesDefault.SelectedValue; settings.CategoriesDefaultLayout = CategoriesDefault.SelectedValue; settings.ProductsDefaultLayout = ProductsDefault.SelectedValue; settings.Save(); // RELOAD THE STORE SETTINGS, TO ENSURE SYCHRONIZATION WITH THE IN MEMORY CACHE IStoreSettingsProvider provider = AbleContext.Resolve <IStoreSettingsProvider>(); provider.Reload(); SelectItem(WebpagesDefault, settings.WebpagesDefaultLayout); SelectItem(CategoriesDefault, settings.CategoriesDefaultLayout); SelectItem(ProductsDefault, settings.ProductsDefaultLayout); LayoutsGrid.DataBind(); }