Search code examples
c#.nettelerik-grid

return data from a field (column) in telerik gridview using IIF


I am using Telerik Winforms Gridview and the Column expression.

I am trying to return data from a field (column) in a gridview using a IIF statement.

The below works:

IIF(customer_name='Bills Hairy Mess','win','lose')

The below crashes the form:

IIF(customer_name='Bills Hairy Mess',cust_ref_1_BOL,'lose')

I also tried

IIF(customer_name='Bills Hairy Mess',[cust_ref_1_BOL],'lose')

cust_ref_1_BOL is a valid field name and is pickable from within the expression editor under 'fields'

Is the above possible?


Solution

  • Turns out you can, fairly easy.

    You do need to make sure that the field is in the columns list for the grid, which is what I was doing wrong.

    It can be not visible, but needs to be there (obviously).

    I had a need to exclude some columns from a export but still use them on the screen for calculations, this works fine by setting their visibility to false right before exporting.