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

RadGrid Filtering EnableLinqExpressions

11 Answers 908 Views
Filter
This is a migrated thread and some comments may be shown as answers.
J
Top achievements
Rank 1
J asked on 13 Jul 2011, 10:17 PM
We upgraded to 4.0 and now none of our filtering works correctly.  I've set EnableLinqExpressions="false" on one page and solved the problems on that page/grid.  Will we have to through our whole app and add & set this tag to every grid or is there a work around????  Additionally, there now seems to be issues with Grid formatting and conflicts with css???  Any clues?  Thank you.

11 Answers, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 19 Jul 2011, 09:57 AM
Hello J,

The provided information is not enough for us to fully understand your scenario. Could you please provide a little bit more details?
What version of RadControls for ASP.NET AJAX have you upgraded to? How is the grid filtered? What is the datasource of the grid and how do you bind it?
Sending us a sample project will be highly appreciated.

I am looking forward to your reply.

Greetings,
Mira
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
J
Top achievements
Rank 1
answered on 21 Jul 2011, 12:08 AM
We Upgraded libraries to v2011.1.621.40.   Now none of the filtering is working on any of the pages.  Adding EnableExpressions="false" to Grids on a page corrects the problem.  Do I really have to go add EnableExpressions="false" to every grid throughout the app to correct this problem?  This is a huge inconvenience.

It's bound to a dataset returned from MS SQL.  See code below

 

 

<telerik:RadGrid AutoGenerateColumns="False" ID="uxRadGrid" AllowFilteringByColumn="true" OnNeedDataSource="uxRadGrid_NeedDataSource"

 

 

 

OnItemCommand="uxRadGrid_ItemCommand" OnItemDataBound="uxRadGrid_ItemDataBound" AllowPaging="true" PageSize="50" AllowSorting="True"

 

 

 

runat="server" EnableEmbeddedSkins="false">

 

 

 

<PagerStyle Mode="NextPrevAndNumeric" AlwaysVisible="true"/>

 

 

 

<GroupingSettings CaseSensitive="false" />

 

 

 

<clientsettings>

 

 

 

<Scrolling ScrollHeight="500px" AllowScroll="True" SaveScrollPosition="True" UseStaticHeaders="True" >

 

 

 

</Scrolling>

 

 

 

<ClientEvents OnGridCreated="GridCreatedWTHScroll" />

 

 

 

</clientsettings>

 

 

 

<MasterTableView OverrideDataSourceControlSorting="true" />

 

 

 

<MasterTableView TableLayout="Fixed" AllowFilteringByColumn="true" EnableHeaderContextMenu="true">

 

 

 

<Columns>

 

 

 

<telerik:GridTemplateColumn Visible="false">

 

 

 

<ItemTemplate>

 

 

 

<asp:Label ID="uxId" runat="server" Text='<%#Eval("ProgTargetID")%>' />

 

 

 

</ItemTemplate>

 

 

 

</telerik:GridTemplateColumn>

 

 

 

<telerik:GridBoundColumn HeaderText="#" DataField="RowNum" UniqueName="RowNum" SortExpression="RowNum"

 

 

 

HeaderStyle-Width="3%" AutoPostBackOnFilter="true" AllowFiltering="false" />

 

 

 

<telerik:GridTemplateColumn Groupable="false" HeaderText="Program Target Name" UniqueName="ProgTargetName" AutoPostBackOnFilter="true"

 

 

 

HeaderStyle-Width="30%" SortExpression="ProgTargetName" DataField="ProgTargetName" FilterControlWidth="260px" CurrentFilterFunction="Contains"

 

 

 

ShowFilterIcon="true" AndCurrentFilterFunction="Contains">

 

 

 

<ItemTemplate><asp:LinkButton runat="server" ID="lnkName" Text='<%#Eval("ProgTargetName")%>' PostBackUrl="return false" CommandName="EditRecord" /></ItemTemplate>

 

 

 

</telerik:GridTemplateColumn>

 

 

 

<telerik:GridBoundColumn HeaderText="Status" DataField="StatusName" UniqueName="StatusName" SortExpression="StatusName"

 

 

 

HeaderStyle-Width="7%" FilterControlWidth="30px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="true"

 

 

 

AndCurrentFilterFunction="Contains" />

 

 

 

<telerik:GridBoundColumn HeaderText="Description" DataField="ProgTargetDesc" UniqueName="ProgTargetDesc" SortExpression="ProgTargetDesc"

 

 

 

HeaderStyle-Width="31%" FilterControlWidth="275px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="true"

 

 

 

AndCurrentFilterFunction="Contains" />

 

 

 

<telerik:GridBoundColumn HeaderText="Modified On" DataField="TranDate" UniqueName="TranDate" SortExpression="TranDateRaw"

 

 

 

HeaderStyle-Width="14%" FilterControlWidth="100px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="true"

 

 

 

AndCurrentFilterFunction="Contains" />

 

 

 

<telerik:GridBoundColumn HeaderText="Modified By" DataField="ByUser" UniqueName="ByUser" SortExpression="ByUser"

 

 

 

HeaderStyle-Width="14%" FilterControlWidth="80px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="true"

 

 

 

AndCurrentFilterFunction="Contains" />

 

 

 

 

<telerik:GridTemplateColumn HeaderText="Action" AllowFiltering="false" Visible="false" HeaderStyle-Width="10%">

 

 

 

<ItemTemplate>

 

 

 

<asp:LinkButton ID="lnkEdit" Text="Edit" runat="server" PostBackUrl="return false;" CommandName="EditRecord" />&nbsp;|

 

 

 

<asp:LinkButton ID="lnkDisable" Text="Disable" runat="server" CommandName="EnableDisable" />

 

 

 

</ItemTemplate>

 

 

 

</telerik:GridTemplateColumn>

 

 

 

</Columns>

 

 

 

</MasterTableView>

 

 

 

</telerik:RadGrid>

 

 




 

 

/// <summary>

 

 

 

/// Need Datasource event of RadGrid

 

 

 

/// </summary>

 

 

 

/// <param name="source"></param>

 

 

 

/// <param name="e"></param>

 

 

 

protected void uxRadGrid_NeedDataSource(object source, GridNeedDataSourceEventArgs e)

 

{

 

 

try

 

{

CLEARTrackerCNI.Framework.

 

ProgramTarget obj = new CLEARTrackerCNI.Framework.ProgramTarget();

 

obj.PageSize = uxRadGrid.PageSize;

obj.PageNum = uxRadGrid.CurrentPageIndex;

obj.SortExpression = uxRadGrid.MasterTableView.SortExpressions.GetSortString();

obj.FilterExpression = uxRadGrid.MasterTableView.FilterExpression;

 

 

DataSet ds = obj.GetAll();

 

 

 

if (Convert.ToInt32(ds.Tables[0].Rows[0][Fields.Cnt]) > 0)

 

{

trMessage.Visible =

 

false;

 

trGrid.Visible =

 

true;

 

uxFilters.Visible =

 

true;

 

uxRadGrid.AllowCustomPaging =

 

true;

 

uxRadGrid.VirtualItemCount =

 

Convert.ToInt32(ds.Tables[0].Rows[0][Fields.Cnt]);

 

uxRadGrid.CurrentPageIndex =

 

Convert.ToInt32(uxRadGrid.CurrentPageIndex);

 

uxRadGrid.PageSize =

 

Convert.ToInt32(uxRadGrid.PageSize);

 

uxRadGrid.DataSource = ds.Tables[1];

uxRadGrid.PagerStyle.AlwaysVisible =

 

true;

 

}

 

 

else

 

{

uxRadGrid.AllowCustomPaging =

 

true;

 

 

 

if (uxRadGrid.MasterTableView.FilterExpression == string.Empty)

 

{

trGrid.Visible =

 

false;

 

uxFilters.Visible =

 

false;

 

trMessage.Visible =

 

true;

 

lblMessage.Text =

 

Messages.Get("NoRecord");

 

}

 

 

else

 

{

uxFilters.Visible =

 

true;

 

uxRadGrid.DataSource =

 

String.Empty;

 

trGrid.Visible =

 

true;

 

uxRadGrid.PagerStyle.AlwaysVisible =

 

false;

 

}

uxRadGrid.VirtualItemCount = 0;

}

}

 

 

catch (Exception ex) { Common.Log("ProgramTarget:List", "uxRadGrid_NeedDataSource", ex, Page); }

 

}




 

 

public override DataSet GetAll()

 

{

 

 

Hashtable prms = new Hashtable();

 

 

 

//if (StatusId > 0) prms[Fields.ProgramTargetStatus] = StatusId;

 

prms[

 

Fields.PageNum] = PageNum;

 

prms[

 

Fields.PageSize] = PageSize;

 

prms[

 

Fields.FilterExp] = FilterExpression;

 

prms[

 

Fields.SortExp] = SortExpression;

 

 

 

DataSet ds = MsSql.ExecuteNoTransQuery(StoredProcedure.GetProgramTarget(prms));

 

 

 

if (MsSql.IsEmpty(ds)) return null;

 

 

 

return ds;

 

}


 

 

 

/// <summary>

 

 

 

 

 

 

 

/// p_GET_ProgramTargets

 

 

 

 

 

 

 

/// </summary>

 

 

 

 

 

 

 

/// <param name="prms">@FilterExp, @SortExp, @PageNum, @PageSize</param>

 

 

 

 

 

 

 

/// <returns>String. Formatted sql statement.</returns>

 

 

 

 

 

 

 

public static String GetProgramTarget(Hashtable prms)

 

{

 

 

return MsSql.GetSqlStmt("p_GET_ProgramTargets", prms);

 

}

0
Mira
Telerik team
answered on 21 Jul 2011, 11:20 AM
Hello J,

Setting EnableLinqExpressions to false is required for filtering grid which is bound to a DataTable.
The default value of this property is true, so you would not have to set it if you use LinqDataSource for example.

I hope this helps.

All the best,
Mira
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
J
Top achievements
Rank 1
answered on 21 Jul 2011, 06:19 PM
No, this doesn't help at all! This is not a new application.  It was an existing project for which we upgraded the Telerik libraries to the latest version.  This tag was not needed in 3.5.  Why would you make that a requirement in 4.0?????  This is ridiculous and very inconvenient.  If we'd known this we wouldn't have upgraded.  If we are having this issue, I know there are a lot other companies having this issue.
0
SWAT
Top achievements
Rank 2
answered on 07 Sep 2011, 09:52 AM
i agree with J. adding mandatory properties that brakes the on-going applications is a pain.
The EnableLinqExpressions is hurting the RadGrid in other places as well (such as in Sum Aggregate function for SmallInt SQL datatype field (which is treated as Byte by the grid), and Count Aggregate for template column that is not bound to any field [row number column for instance]).

Ilan.
0
Mira
Telerik team
answered on 07 Sep 2011, 03:12 PM
Hello,

When the LINQ expressions of the RadGrid are enabled, the performance is significantly improved because the grid uses dynamic LINQ expressions for all data operations.
However, this leads to some limitations and that is why the EnableLinqExpressions property is provided.

Please let us know if any further questions arise.

Greetings,
Mira
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Aaron
Top achievements
Rank 1
answered on 29 Feb 2012, 09:01 PM
"Setting EnableLinqExpressions to false is required for filtering grid which is bound to a DataTable."

Where is the documentation on this?

If it is documented, please consider documenting it here as well - http://www.telerik.com/help/aspnet-ajax/grid-binding-to-datatable-or-dataset.html.
0
John Chatt
Top achievements
Rank 1
answered on 01 Mar 2012, 05:32 PM
I agree with Aaron this is ridiculous. Document this better, it's not like this is new
0
Tsvetina
Telerik team
answered on 05 Mar 2012, 10:59 AM
Hello,

It seems a little misunderstanding has occured here - it is fine to bind to a DataTable and not set EnableLinqExpressions="false" as long as you do not perform manual filtering that requires T-SQL syntax. I am attaching a sample page which demonstrates a grid being bound to a DataTable and filtering seamlessly with filter expressions turned on.

The need for turning off LINQ expressions in scenarios where filtering is done using Transact SQL syntax is noted in each help topic elaborating on filter expressions. The note states:
With the .NET 3.5 build of RadGrid for ASP.NET AJAX and LINQ filter expressions enabled (EnableLinqExpressions = true), the filter expressions set for the grid either internally by its filtering mechanism or manually in code should conform to the LINQ expression syntax instead of the old T-SQL syntax. Only thus they will be evaluated properly by the control.

Kind regards,
Tsvetina
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.
0
J
Top achievements
Rank 1
answered on 06 Mar 2012, 12:33 AM
I don't think there is a misunderstanding and I am not sure what the point is.  We were using manual filtering as well as the filtering built into the grid interchangeably in our application.  This was working fine with the previous version of the controls.  When we upgraded our controls, suddenly filtering quit working.  We discovered then that this new tag was added and required to  be set on the grid with the new controls for filtering to work correctly, therefore we had to go through the whole application and add this tag to every page/grid that had filtering enabled.  The point is that Telerik added a required tag to the grid control that was not required in previous version therefore inconveniencing your customers.
0
Tsvetina
Telerik team
answered on 06 Mar 2012, 10:28 AM
Hello,

We understand your frustration and we know that it could be annoying to have to go through many pages and add settings that were not previously needed. However, as the new LINQ-based queries of RadGrid improved performance of RadGrid a lot, it was not in the general customer's interest to leave them turned off by default. We try to offer the customer the best possible performance and behavior from the control with the least amount of customizations, of course, where this is possible.
Excuse us for any inconvenience caused by this, I hope that we do not lead you to such experience with future versions of the grid.

Regards,
Tsvetina
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
Filter
Asked by
J
Top achievements
Rank 1
Answers by
Mira
Telerik team
J
Top achievements
Rank 1
SWAT
Top achievements
Rank 2
Aaron
Top achievements
Rank 1
John Chatt
Top achievements
Rank 1
Tsvetina
Telerik team
Share this question
or