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

Grid Calculated Columns

1 Answer 157 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mike_T
Top achievements
Rank 1
Mike_T asked on 19 Nov 2011, 07:00 PM
Hi guys,

I have a grid that i added to it 2 columns that represents a calculated fields, the grid is like this and i'm using a stored procedure to get the data from SQL, the calculated columns are not returned in the query, i receive the following error when i load the page

Illegal Expression for column: BLBP


What it could be the problem?

thanks

<Telerik:RadGrid ID="DataGrid" runat="server" Skin="Simple" SkinID="Simple" Width="100%"
               ShowStatusBar="True" AllowFilteringByColumn="false" AllowAutomaticDeletes="false"
               ShowFooter="true" AllowAutomaticInserts="False" AllowAutomaticUpdates="False"
               AllowPaging="True" AutoGenerateColumns="False" PageSize="100" GridLines="Both">
               <PagerStyle Mode="NextPrevAndNumeric" />
               <MasterTableView AutoGenerateColumns="False" AllowSorting="false" EditMode="InPlace"
                   CommandItemDisplay="none" DataKeyNames="ClientID" EditFormSettings-EditFormType="Template">
                   <Columns>
                       <Telerik:GridBoundColumn DataField="ClientID" Visible="False" HeaderText="ClientID"
                           ReadOnly="True" SortExpression="ClientID" UniqueName="ClientID" />
                       <Telerik:GridBoundColumn DataField="ClientName" Visible="False" HeaderText="ClientName"
                           ReadOnly="True" SortExpression="ClientName" UniqueName="ClientName" />
                       <Telerik:GridBoundColumn DataField="ModifiedDate" Visible="True" HeaderText="Date"
                           ReadOnly="True" SortExpression="ModifiedDate" UniqueName="ModifiedDate" DataType="System.DateTime"
                           DataFormatString="{0:dddd dd/MM/yyyy}" />
                       <Telerik:GridBoundColumn DataField="Notes" Visible="True" HeaderText="Description"
                           ReadOnly="True" SortExpression="Notes" UniqueName="Notes" />
                       <Telerik:GridNumericColumn DataField="BillNumber" HeaderText="Code" SortExpression="BillNumber"
                           UniqueName="BillNumber" FooterText=" " DataFormatString="{0:###,###.##}" />
                             
                       <Telerik:GridNumericColumn DataField="AmountLL" Aggregate="Sum" HeaderText="INV/LBP"
                           SortExpression="AmountLL" UniqueName="AmountLL" FooterText=" " DataType="System.Decimal"
                           DataFormatString="{0:###,###.##}" />
                       <Telerik:GridNumericColumn DataField="ValueLBP" Aggregate="Sum" Visible="true" HeaderText="Credit LBP"
                           SortExpression="ValueLBP" UniqueName="ValueLBP" FooterText=" " DataType="System.Decimal"
                           DataFormatString="{0:###,###.##}" />
                             
                       <Telerik:GridCalculatedColumn HeaderText="Balance LBP" UniqueName="BLBP" DataType="System.Decimal"  
                           DataFields="AmountLL, ValueLBP" Expression="{5}-{6}" />
                           
                             
                       <Telerik:GridNumericColumn DataField="AmountUSD" Aggregate="Sum" Visible="true" HeaderText="INV/USD"
                           SortExpression="AmountUSD" UniqueName="AmountUSD" FooterText=" " DataType="System.Decimal"
                           DataFormatString="{0:###,###.##}" />
                       <Telerik:GridNumericColumn HeaderText="Credit USD" DataField="ValueUSD" Aggregate="Sum"
                           Visible="true" SortExpression="ValueUSD" UniqueName="ValueUSD" FooterText=" "
                           DataType="System.Decimal" DataFormatString="{0:###,###.##}" />
                             
                            <Telerik:GridCalculatedColumn HeaderText="Balance USD" UniqueName="BUSD"  DataType="System.Double"
                           DataFields="AmountUSD, ValueUSD" Expression="{5}-{6}" /> 
                   </Columns>
                   <PagerStyle Mode="NextPrevNumericAndAdvanced" PageButtonCount="100" />
               </MasterTableView>
               <ClientSettings AllowColumnsReorder="false" EnableRowHoverStyle="false">
                   <Selecting AllowRowSelect="false" />
               </ClientSettings>
           </Telerik:RadGrid>

1 Answer, 1 is accepted

Sort by
0
Accepted
Iana Tsolova
Telerik team
answered on 23 Nov 2011, 09:51 AM
Hello Mike_T,

Could you specify what if the data type of the AmountLL and ValueLBP columns? Can you replicate the error in a sample project with dummy data?

Best wishes,
Iana Tsolova
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
Grid
Asked by
Mike_T
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Share this question
or