Using this example as our template......
http://demos.telerik.com/silverlight/#GridView/Search
we are having an issue --- if the database field is defined as 'nullable' an exception is occurring
on the line
convertedValue = Convert.ChangeType(FilterValue, descriptor.MemberType, CultureInfo.CurrentCulture);
The exception is:
cannot convert string to Nullable<Decimal>
How do we fix this issue? (Entire function is listed below)
Tony
private void UpdateCompositeFilterValues()
{
foreach (FilterDescriptor descriptor in _compositeFilterDesriptor.FilterDescriptors)
{
if (descriptor.MemberType == null) continue;
var convertedValue = DefaultValue(descriptor.MemberType);
try
{
convertedValue = Convert.ChangeType(FilterValue, descriptor.MemberType, CultureInfo.CurrentCulture);
********************************************************************
Exception here: cannot convert string to Nullable<Decimal>
********************************************************************************************************
}
catch (Exception e)
{
Logger.Error("CreateFilterExpression " + e.Message);
}
if (descriptor.MemberType.IsAssignableFrom(typeof(DateTime)))
{
DateTime date;
if (DateTime.TryParse(FilterValue, out date))
{
convertedValue = date;
}
}
descriptor.Value = convertedValue;
}
}
http://demos.telerik.com/silverlight/#GridView/Search
we are having an issue --- if the database field is defined as 'nullable' an exception is occurring
on the line
convertedValue = Convert.ChangeType(FilterValue, descriptor.MemberType, CultureInfo.CurrentCulture);
The exception is:
cannot convert string to Nullable<Decimal>
How do we fix this issue? (Entire function is listed below)
Tony
private void UpdateCompositeFilterValues()
{
foreach (FilterDescriptor descriptor in _compositeFilterDesriptor.FilterDescriptors)
{
if (descriptor.MemberType == null) continue;
var convertedValue = DefaultValue(descriptor.MemberType);
try
{
convertedValue = Convert.ChangeType(FilterValue, descriptor.MemberType, CultureInfo.CurrentCulture);
********************************************************************
Exception here: cannot convert string to Nullable<Decimal>
********************************************************************************************************
}
catch (Exception e)
{
Logger.Error("CreateFilterExpression " + e.Message);
}
if (descriptor.MemberType.IsAssignableFrom(typeof(DateTime)))
{
DateTime date;
if (DateTime.TryParse(FilterValue, out date))
{
convertedValue = date;
}
}
descriptor.Value = convertedValue;
}
}