We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Expression Field Type

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

3 Replies

AD Administrator 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 >


AD Administrator 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 >>


HB Heath Brand February 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

Loader.
Live Chat Icon For mobile
Up arrow icon