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

Can't have DataField with Join, a GridCalculatedColumn, and Filtering all in one

1 Answer 93 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 03 Feb 2014, 12:03 AM

I'm trying to fix up a page so that the RadGrid has working filters. This has been fine on other pages, but the presence of a GridBoundColumn with a join in the DataField, and a GridCalculatedColumn is making this difficult.

My findings:
 - Originally, EnableLinqExpressions ("ELE") was set to "false", but this meant that filtering didn't work
 - ELE = false and removing the Calculated field --> Filtering works
 - ELE = false and removing the Joined filed --> Filtering is broken
 - ELE = true --> I get a Telerik.Web.UI.ParseException: ')' or ',' expected. No clear column as the culprit, error seems derived from the GridyDynamicQueryable.Select()
 - ELE = true and removing Calculated field --> Filtering works
 - ELE = true and removing Joined field --> Filtering works

And my boiled-down code:

<telerik:RadGrid ID="rgdInvoices" runat="server" DataSourceID="ldsInvoices" AutoGenerateColumns="false"
    AllowFilteringByColumn="true" EnableLinqExpressions="true" ShowFooter="true">
        <MasterTableView DataKeyNames="InvoiceID" EditMode="InPlace">
            <Columns>
                <telerik:GridBoundColumn UniqueName="BookingName" DataField="WEB_Booking.JobName" HeaderText="Job Name"
                    AutoPostBackOnFilter="true" ShowFilterIcon="false" />
 
                <telerik:GridNumericColumn UniqueName="SubTotal" DataField="SubTotal" ReadOnly="true"
                    HeaderText="Sub Total" NumericType="Currency" FilterControlWidth="120px"
                    Aggregate="Sum" FooterAggregateFormatString="{0:c}" />
                 
                <telerik:GridCalculatedColumn UniqueName="GST" HeaderText="GST" DataType="System.Decimal"
                    DataFormatString="{0:c}" DataFields="SubTotal" Expression="{0}*0.1" Aggregate="Sum"
                    FooterAggregateFormatString="{0:c}" />
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>

It seems to me that there's an error with the code of a filtering function when a Join and Calculated field are being used. I also don't want to have to denormalise my database, but if I can't find a resolution soon, I'll have to do that.



1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 06 Feb 2014, 10:01 AM
Hi Andrew,

The following forum thread elaborates on a similar problem and a sample projects with GridCalculatedColumn are also attached in it:
http://www.telerik.com/forums/gridcalculatedcolumn-and-enablelinqexpressions-false-cause-exception

Give them a try and let me know if they help.

Regards,
Pavlina
Telerik
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 UI for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Grid
Asked by
Andrew
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or