Thank
Vignesh.
You said : "So kindly skip defining the ColumnType if you are not aware of the type explicitly, Grid will handle this for you."
I
can’t let the grid define types for me because I have columns filled with “null”
values (at least on the first launch of my application) and I encounter this
problem Filtering not working when cell is null.
I do my own method :
[code]
public ColumnType GetColumnType(Type type)
{
if ((type == typeof(int)) || (type == typeof(int?))
|| (type == typeof(short)) || (type == typeof(short?))
|| (type == typeof(long)) || (type == typeof(long?))
|| (type == typeof(float)) || (type == typeof(float?))
|| (type == typeof(decimal)) || (type == typeof(decimal?))
|| (type == typeof(byte)) || (type == typeof(byte?)))
{
return ColumnType.Number;
}
else if ((type == typeof(bool)) || (type == typeof(bool?)))
{
return ColumnType.Boolean;
}
else if ((type == typeof(DateTime)) || (type == typeof(DateTime?))
|| (type == typeof(DateTimeOffset)) || (type == typeof(DateTimeOffset?)))
{
return ColumnType.DateTime;
}
else
{
return ColumnType.String;
}
}
[/code]
François
public ColumnType GetColumnType(Type type)
{
if ((type == typeof(int)) || (type == typeof(int?))
|| (type == typeof(uint)) || (type == typeof(uint?))
|| (type == typeof(short)) || (type == typeof(short?))
|| (type == typeof(ushort)) || (type == typeof(ushort?))
|| (type == typeof(long)) || (type == typeof(long?))
|| (type == typeof(ulong)) || (type == typeof(ulong?))
|| (type == typeof(float)) || (type == typeof(float?))
|| (type == typeof(decimal)) || (type == typeof(decimal?))
|| (type == typeof(double)) || (type == typeof(double?))
|| (type == typeof(byte)) || (type == typeof(byte?)) )
{
return ColumnType.Number;
}
else if ((type == typeof(bool)) || (type == typeof(bool?)))
{
return ColumnType.Boolean;
}
else if ((type == typeof(DateTime)) || (type == typeof(DateTime?))
|| (type == typeof(DateTimeOffset)) || (type == typeof(DateTimeOffset?)))
{
return ColumnType.DateTime;
}
else
{
return ColumnType.String;
}
}
|
|