I'm using UniGrid.
// Loop trough all columns
for (int i = 0; i < columnList.Count; i++)
{
string column = columnList.ToString();
// Get field caption
FormFieldInfo ffi = FormInfo.GetFormField(column);
string fieldCaption = string.Empty;
if (ffi == null)
{
fieldCaption = column;
}
else
{
fieldCaption = (ffi.Caption == string.Empty) ? column : ResHelper.LocalizeString(ffi.Caption);
}
Column columnDefinition = new Column()
{
Caption = fieldCaption,
Source = column,
ExternalSourceName = column,
AllowSorting = true,
Wrap = false
};
if (showFiltersItems.Contains(column))
{
ColumnFilter filter = new ColumnFilter();
switch (ffi.DataType)
{
case FormFieldDataTypeEnum.LongText: filter.Type = "text";
break;
case FormFieldDataTypeEnum.DateTime: filter.Type = "text";
break;
case FormFieldDataTypeEnum.Decimal: filter.Type = "double";
break;
default:
filter.Type = ffi.DataType.ToString();
break;
}
filter.Source = column;
columnDefinition.Filter = filter;
}
if (i == columnList.Count - 1)
{
// Stretch last column
columnDefinition.Width = "100%";
}
UniGridDescriptions.GridColumns.Columns.Add(columnDefinition);
}
// Set column names
UniGridDescriptions.Columns = columnNames;