private void BindGridColumns() { using (EditConfigurationProvider provider = new EditConfigurationProvider()) { Aspect.Domain.Product prod = provider.GetProduct(this.ProductID); if (prod == null) return; this.Title = HeaderLiteral.Text = string.Format(HeaderLiteral.Text, prod.PublicName, prod.Version == null ? string.Empty : prod.Version.ToString()); HeaderDateLiteral.Text = string.Format(HeaderDateLiteral.Text, DateTime.Now.ToShortDateString(), DateTime.Now.ToLongTimeString()); //--- SelectorProductGridField selector = new SelectorProductGridField(string.Empty, "ConfigurationID", true); selector.ItemStyle.Width = new Unit(15, UnitType.Pixel); EditConfigurationGrid.Columns.Add(selector); //--- bool actionColumnAdded = false; List<GridColumn> list = provider.GetGridColumns(); foreach (GridColumn item in list) { BoundField field = null; EditableGridColumn editableColumn = item as EditableGridColumn; if (editableColumn == null) { if (item.GridColumnType == TypeEnum.Boolean) { field = new BooleanGridField(); field.DataField = item.DataItem; field.HeaderText = item.Name; field.ReadOnly = true; } else { if (!actionColumnAdded) { field = new ActionProductGridField(item.Name, item.DataItem); actionColumnAdded = true; } else { field = new ProductGridField(item.Name, item.DataItem); } field.ItemStyle.Font.Size = new FontUnit(FontSize.Smaller); } //field = new ActionProductGridField(item.Name, item.DataItem); } else { if (editableColumn.View == EditableGridColumn.GridColumnView.TextBox) { field = new TextBoxProductGridField(editableColumn); } else if (editableColumn.View == EditableGridColumn.GridColumnView.DropDown) { field = new DropDownProductGridField(editableColumn/*, editableColumn.DataSource.DataSource*/); } else if (editableColumn.View == EditableGridColumn.GridColumnView.CheckBox) { field = new CheckBoxProductGridField(editableColumn); } } if (field != null) { EditConfigurationGrid.Columns.Add(field); //EditAddedConfigurationGrid.Columns.Add(field); } } } }
private void BindGridColumns() { ProductGrid.Columns.Clear(); /*for (int i = 1; i < ProductGrid.Columns.Count; i++) { ProductGrid.Columns.RemoveAt(i); }*/ //SelectorProductGridField selector = new SelectorProductGridField(string.Empty, Common.IDColumnTitle); //ProductGrid.Columns.Add(selector); SelectorProductGridField selector = new SelectorProductGridField(string.Empty, "ID", true, SelectedProductsHidden.ClientID); selector.ItemStyle.Width = new Unit(15, UnitType.Pixel); ProductGrid.Columns.Add(selector); List<GridColumn> columns = new List<GridColumn>(); ContentDomain provider = null; try { provider = Common.GetContentDomain(ClassifiacationTypeView); if (provider != null) columns = provider.GetGridColumns(this.User.ID, RequestClassificationTreeID, FieldPlaceHolder.Grid); } finally { if (provider != null) provider.Dispose(); } bool actionColumnAdded = false; foreach (GridColumn item in columns) { BoundField field; if (!actionColumnAdded) { field = new TreeActionProductGridField(item.Name, item.DataItem); /*field.SortExpression = item.DataItem;*/ //ProductGrid.Columns.Add(field); actionColumnAdded = true; } else { if (item.GridColumnType == TypeEnum.Boolean) { field = new BooleanGridField(); field.DataField = item.DataItem; field.HeaderText = item.Name; field.ReadOnly = true; } else { field = new ProductGridField(item.Name, item.DataItem); /*field.SortExpression = item.DataItem;*/ //ProductGrid.Columns.Add(field); } } ProductGrid.Columns.Add(field); } }