public static GridViewDataColumn AutoGenerateGridColumn( System.Type columnType, ISite site) { if (columnType.IsGenericType && (object)columnType.GetGenericTypeDefinition() == (object)typeof(Nullable <>)) { columnType = Nullable.GetUnderlyingType(columnType); } GridViewDataColumn gridViewDataColumn; if ((object)columnType == (object)typeof(bool) || (object)columnType == (object)typeof(Telerik.WinControls.Enumerations.ToggleState)) { gridViewDataColumn = (GridViewDataColumn) new GridViewCheckBoxColumn(); } else if ((object)columnType == (object)typeof(byte[]) || (object)columnType == (object)typeof(Image) || ((object)columnType == (object)typeof(Icon) || (object)columnType == (object)typeof(Bitmap))) { gridViewDataColumn = (GridViewDataColumn) new GridViewImageColumn(); } else if ((object)columnType == (object)typeof(DateTime)) { gridViewDataColumn = (GridViewDataColumn) new GridViewDateTimeColumn(); } else if (GridViewHelper.IsNumeric(columnType) || GridViewHelper.IsNumericSql(columnType)) { gridViewDataColumn = (GridViewDataColumn) new GridViewDecimalColumn(); gridViewDataColumn.DataType = columnType; } else if ((object)columnType == (object)typeof(Color)) { gridViewDataColumn = (GridViewDataColumn) new GridViewColorColumn(); } else if (columnType.IsEnum) { GridViewComboBoxColumn viewComboBoxColumn = new GridViewComboBoxColumn(); (EnumBinder)columnType.Target = (object)viewComboBoxColumn; if (site != null) { IDesignerHost service = (IDesignerHost)site.GetService(typeof(IDesignerHost)); if (service != null) { EnumBinder component = (EnumBinder)service.CreateComponent(typeof(EnumBinder)); component.Source = columnType; component.Target = (object)viewComboBoxColumn; } } viewComboBoxColumn.DataType = columnType; gridViewDataColumn = (GridViewDataColumn)viewComboBoxColumn; } else { gridViewDataColumn = (GridViewDataColumn) new GridViewTextBoxColumn(); } return(gridViewDataColumn); }