This is a migrated thread and some comments may be shown as answers.

Two different data types for DataFields

1 Answer 80 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bob
Top achievements
Rank 1
Bob asked on 25 Apr 2014, 05:37 PM
I have the following in my Telerik Grid:

<telerik:GridCalculatedColumn HeaderText="Remark Code" DataFields="RemarkCodeID, RemarkCodeName" Expression='{0} + " - " + {1}' DataFormatString="{0:N}" ></telerik:GridCalculatedColumn>

I get an error that cannot convert an Int and RemarkCodeID is an int above.  Is there a way I can convert RemarkCodeID to a string?  Also, when I replace RemarkCodeID with a data field that is of type string, no error so I know it is RemarkCodeID that is causing the error.

Error:
System.ArgumentException: Expression of type 'System.Nullable`1[System.Int32]' cannot be used for parameter of type 'System.Object' of method 'System.String Concat(System.Object, System.Object)'

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 28 Apr 2014, 04:25 AM
Hi Bob,

Please try setting EnableLinqExpressions="false" for your grid and check if the issue exists.

ASPX:
<telerik:RadGrid ID="RadGrid1" runat="server" EnableLinqExpressions="false". . >
    <MasterTableView >
        <Columns>         
            <telerik:GridCalculatedColumn HeaderText="Remark Code" DataFields="RemarkCodeID, RemarkCodeName" Expression='{0} + " - " + {1}' DataFormatString="{0:N}">
            </telerik:GridCalculatedColumn>
        </Columns>
    </MasterTableView>
</telerik:RadGrid>

Thanks,
Princy
Tags
Grid
Asked by
Bob
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or