The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
Hi,
I''m getting an exception when the wrong type is assigned to an expression field. For example,
Run the MultipleRecordSelection sample in the Grid.Grouping samples, and add an expression field using the property editor as follows:
[CustomerID] like ''ALFKI''
It creates the expression field column in the grid, but when you move the mouse over the column an exception is generated.
Is there any way to avoid this? In my app the user is free to select any type from the list.
thanks,
Heath
ADAdministrator Syncfusion Team February 7, 2006 05:52 AM UTC
I forgot to mention that I''m assigning the System.Boolean type to the expression field result.
>Hi,
>
>I''m getting an exception when the wrong type is assigned to an expression field. For example,
>
>Run the MultipleRecordSelection sample in the Grid.Grouping samples, and add an expression field using the property editor as follows:
>
>[CustomerID] like ''ALFKI''
>
>It creates the expression field column in the grid, but when you move the mouse over the column an exception is generated.
>
>Is there any way to avoid this? In my app the user is free to select any type from the list.
>
>thanks,
>Heath
>
ADAdministrator Syncfusion Team February 7, 2006 02:19 PM UTC
Hi Heath,
right now the only option to get this working is to add a custom function with ExpressionFieldEvaluator.AddFuntion and that function returns "True" or "False".
But we can also add support for automatic type conversion to boolean when "1" or "0" is returned.
We already have the Syncfusion.Styles.ValueConvert.ChangeType function that takes care of sucn conversions but we did not use it in FieldDescriptor.GetValue. We can change that for future builds.
Stefan
>I forgot to mention that I''m assigning the System.Boolean type to the expression field result.
>
>
>
>>Hi,
>>
>>I''m getting an exception when the wrong type is assigned to an expression field. For example,
>>
>>Run the MultipleRecordSelection sample in the Grid.Grouping samples, and add an expression field using the property editor as follows:
>>
>>[CustomerID] like ''ALFKI''
>>
>>It creates the expression field column in the grid, but when you move the mouse over the column an exception is generated.
>>
>>Is there any way to avoid this? In my app the user is free to select any type from the list.
>>
>>thanks,
>>Heath
>>
HBHeath BrandFebruary 7, 2006 07:23 PM UTC
Thanks for the idea.
I may have found an alternate solution that will fix my problem, which is always use System.String as the expression field result type. Then use the Cell Value Type to format the value as needed (e.g. convert to a Boolean or some other type). Using System.String as the exp. field result type seems to always work and never crashes the grid, even if the expression syntax is incorrect. If this sounds off, please let me know.
thanks,
Heath