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 Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { // initialize the layout string layoutPath = Request.QueryString["name"]; if (!string.IsNullOrEmpty(layoutPath) && File.Exists(Server.MapPath(layoutPath))) { string layoutContents = LayoutDataSource.LoadFileContents(layoutPath); switch (this.PageSection) { case CommerceBuilder.UI.PageSection.Header: this._SelectedControls = ParseExistingLayout(layoutContents, "PageHeader"); break; case CommerceBuilder.UI.PageSection.LeftSideBar: this._SelectedControls = ParseExistingLayout(layoutContents, "LeftSidebar"); break; case CommerceBuilder.UI.PageSection.RightSidebar: this._SelectedControls = ParseExistingLayout(layoutContents, "RightSidebar"); break; case CommerceBuilder.UI.PageSection.Footer: this._SelectedControls = ParseExistingLayout(layoutContents, "PageFooter"); break; } UpdateHiddenControlsViewState(); } } }
private async void getData() { var cpDataGroups = await LayoutDataSource.GetGroupsAsync(); foreach (LayoutDataGroup c in cpDataGroups) { DefaultViewModel.Add(c); } }
protected void LayoutsGrid_RowCommand(object sender, GridViewCommandEventArgs e) { string filePath = e.CommandArgument.ToString(); if (e.CommandName.ToLower() == "do_delete") { LayoutDataSource.Delete(filePath); } BindLayouts(); }