コード例 #1
0
        public virtual string GetCellFormattedValue(GridViewRowInfo row, GridViewColumn column)
        {
            GridViewDataColumn gridViewDataColumn = column as GridViewDataColumn;

            if (gridViewDataColumn == null || string.IsNullOrEmpty(gridViewDataColumn.FormatString) && !(gridViewDataColumn is GridViewComboBoxColumn))
            {
                Convert.ToString(row[column]);
            }
            GridViewComboBoxColumn viewComboBoxColumn1 = gridViewDataColumn as GridViewComboBoxColumn;
            object lookupValue = row[column];

            if (viewComboBoxColumn1 != null && viewComboBoxColumn1.HasLookupValue)
            {
                lookupValue = viewComboBoxColumn1.GetLookupValue(lookupValue);
            }
            GridDataConversionInfo dataConversionInfo  = new GridDataConversionInfo(column as IDataConversionInfoProvider);
            GridViewComboBoxColumn viewComboBoxColumn2 = column as GridViewComboBoxColumn;

            if (viewComboBoxColumn2 != null)
            {
                dataConversionInfo.DataType          = viewComboBoxColumn2.DisplayMemberDataType;
                dataConversionInfo.DataTypeConverter = TypeDescriptor.GetConverter(viewComboBoxColumn2.DisplayMemberDataType);
            }
            return(RadDataConverter.Instance.Format(lookupValue, typeof(string), (IDataConversionInfoProvider)dataConversionInfo) as string);
        }
コード例 #2
0
        protected override string ApplyFormatString(object value)
        {
            GridDataConversionInfo dataConversionInfo = new GridDataConversionInfo((IDataConversionInfoProvider)this);
            GridViewComboBoxColumn columnInfo         = (GridViewComboBoxColumn)this.ColumnInfo;

            dataConversionInfo.DataType          = columnInfo.DisplayMemberDataType;
            dataConversionInfo.DataTypeConverter = TypeDescriptor.GetConverter(columnInfo.DisplayMemberDataType);
            return(RadDataConverter.Instance.Format(value, typeof(string), (IDataConversionInfoProvider)dataConversionInfo) as string);
        }