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

RadGrid FilterExpression esql

1 Answer 187 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Zeeshan
Top achievements
Rank 1
Zeeshan asked on 22 Nov 2010, 04:08 PM
Hello I am using custsom paging, sorting and filtering inside NeedDataSource event. To retrieve data, I am using Entity Framework under the covers. Is there any way i can get the FilterExpression in hte form of esql. From what it appears, radgrid only returns esql where clause when you use entitydatasource. can u configure somewhere in radgrid to return the where clause in the form of esql so i can use hte builder methods. There are several reasons why i cant use linq in this case. here is what i what i have.

private string _filterExpression;
    protected void RadGrid1_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
    {
        int startRowIndex = RadGrid1.CurrentPageIndex * RadGrid1.PageSize;
        int maximumRows = RadGrid1.PageSize;
        string sort = RadGrid1.MasterTableView.SortExpressions.GetSortString();
        _filterExpression = RadGrid1.MasterTableView.FilterExpression;
        //needed to bypass RadGrid's internal filtering
        RadGrid1.MasterTableView.FilterExpression = string.Empty;
        if (configuration == null)
        {
            configuration = new SystemSetupFieldConfiguration(TagPrefixList, startRowIndex, maximumRows, sort, _filterExpression);
        }
        var combinedfields = configuration.GetCombinedFields();
        var fieldcount = configuration.CombinedFieldsCount;
        RadGrid1.VirtualItemCount = fieldcount;
        RadGrid1.DataSource = combinedfields;
        
    }

internally i want to be able to apply the filter using builder methods in linq to entities instead of linq query.
db.Customers.Where(filter).OrderBy(orderby).Skip(startrow).Take(maxrows);

Please help!

1 Answer, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 25 Nov 2010, 12:00 PM
Hello Zeeshan,

Unfortunately the RadGrid does not support automatic conversion of FilterExpression to esql. The grid filter expressions have different syntax as described below:
For .NET 2.0 they are using SQL syntax.
For .NET 3.5 or 4.0 when EnableLinqExpressions is set to true (default) they are using LINQ syntax.
For .NET 2.0 when EnableLinqExpressions is set to false the filter expressions are using the SQL syntax.
If you use .NET 3.5 or 4.0 build of RadGrid for ASP.NET AJAX and LINQ filter expressions enabled (EnableLinqExpressions = true) you should conform to the LINQ expression syntax instead of the old SQL syntax.
More information about FilterExpression you could find on the following link:
http://www.telerik.com/help/aspnet-ajax/grdoperatewithfilterexpression.html

Sincerely yours,
Radoslav
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Grid
Asked by
Zeeshan
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
Share this question
or