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

[Solved] FilterExpression Linq Syntax?

3 Answers 308 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jeanne
Top achievements
Rank 1
Jeanne asked on 19 Mar 2013, 07:51 PM
What exactly is the syntax for the FilterExpression? Sometimes it looks VB-like, other time C#-like. For example:

IsEmpty: (it["Member"] = "")
NotIsEmpty: (it["Member"] <> "")
IsNull: (it["Member"] == Convert.DBNull)
NotIsNull: ((it["Member"] != Convert.DBNull))

The first two linq expressions use = and <>, which is VB-like, but the second two use == and !=, which is C#-like!

Note: These were generated one after the other on the same grid with no other changes. Column type is GridBoundColumn (created in code-behind) with DataType = System.String.

3 Answers, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 22 Mar 2013, 11:44 AM
Hello Jeanne,

Do go carefully through the following help topic - it should contain the answer to your qestion:
http://www.telerik.com/help/aspnet-ajax/grid-operate-with-filter-expression-manually.html


All the best, Tsvetoslav
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
Jeanne
Top achievements
Rank 1
answered on 22 Mar 2013, 01:00 PM
Although full of interesting examples, that topic does not explain the SYNTAX of the expressions, not why the IsNull and NotIsNull expressions use C# expression operators while the others use VB expression operators.
0
Marin
Telerik team
answered on 27 Mar 2013, 11:34 AM
Hi,

 The syntax of the expressions is based on the Dynamic LINQ Query Library as described in this blog post. You can check there the actual implementation to see why exactly this particular syntax is required.

Greetings,
Marin
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
Jeanne
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Jeanne
Top achievements
Rank 1
Marin
Telerik team
Share this question
or