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

Custom Sorting/Filtering

8 Answers 199 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ron
Top achievements
Rank 1
Ron asked on 28 Oct 2010, 09:12 PM
Hi,

I'm new using the telerik's controls so I need some help. Let's start also saying that the controls that we have are the trials controls because we are in the process of buying them

We have a multi-tier application, the asp.net client, a bunch WCF services and the Entity framework to access the DB, the client to access the data must go thru the WCF services. We are evaluating the RADGRID to see how it integrates in this environment without doing a lot of changes in our code. All the Grid will have multicolumn filtering and sorting.

What I been trying to do is to implement the Sorting and filtering, this looks very easy when the grid is connected to the database but I can't find any examples of how to do it in a custom way, meaning I want to retrieve the filtering and sorting expressions from the grid, send these as parameters to the WCF service, retrieve the data and then bind the results into the grid again.

When i try to do this just by storing the initial retrieved rows from the DB into the session and then in the ItemCommand event just rebind the grid with those same results I get the following error :

Expression expected

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: Telerik.Web.UI.ParseException: Expression expected

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[ParseException: Expression expected]
   Telerik.Web.UI.ExpressionParser.ParsePrimaryStart() +227
   Telerik.Web.UI.ExpressionParser.ParsePrimary() +36
   Telerik.Web.UI.ExpressionParser.ParseUnary() +404
   Telerik.Web.UI.ExpressionParser.ParseMultiplicative() +54
   Telerik.Web.UI.ExpressionParser.ParseAdditive() +54
   Telerik.Web.UI.ExpressionParser.ParseComparison() +69
   Telerik.Web.UI.ExpressionParser.ParseLogicalAnd() +49
   Telerik.Web.UI.ExpressionParser.ParseLogicalOr() +49
   Telerik.Web.UI.ExpressionParser.ParseExpression() +60
   Telerik.Web.UI.ExpressionParser.ParseArguments() +68
   Telerik.Web.UI.ExpressionParser.ParseArgumentList() +96
   Telerik.Web.UI.ExpressionParser.ParseIif() +58
   Telerik.Web.UI.ExpressionParser.ParseIdentifier() +234
   Telerik.Web.UI.ExpressionParser.ParsePrimaryStart() +65
   Telerik.Web.UI.ExpressionParser.ParsePrimary() +36
   Telerik.Web.UI.ExpressionParser.ParseUnary() +404
   Telerik.Web.UI.ExpressionParser.ParseMultiplicative() +54
   Telerik.Web.UI.ExpressionParser.ParseAdditive() +54
   Telerik.Web.UI.ExpressionParser.ParseComparison() +69
   Telerik.Web.UI.ExpressionParser.ParseLogicalAnd() +49
   Telerik.Web.UI.ExpressionParser.ParseLogicalOr() +49
   Telerik.Web.UI.ExpressionParser.ParseExpression() +60
   Telerik.Web.UI.ExpressionParser.ParseParenExpression() +63
   Telerik.Web.UI.ExpressionParser.ParsePrimaryStart() +151
   Telerik.Web.UI.ExpressionParser.ParsePrimary() +36
   Telerik.Web.UI.ExpressionParser.ParseUnary() +404
   Telerik.Web.UI.ExpressionParser.ParseMultiplicative() +54
   Telerik.Web.UI.ExpressionParser.ParseAdditive() +54
   Telerik.Web.UI.ExpressionParser.ParseComparison() +69
   Telerik.Web.UI.ExpressionParser.ParseLogicalAnd() +49
   Telerik.Web.UI.ExpressionParser.ParseLogicalOr() +49
   Telerik.Web.UI.ExpressionParser.ParseExpression() +60
   Telerik.Web.UI.ExpressionParser.Parse(Type resultType) +58
   Telerik.Web.UI.DynamicExpression.ParseLambda(ParameterExpression[] parameters, Type resultType, String expression, Object[] values) +81
   Telerik.Web.UI.DynamicExpression.ParseLambda(Type itType, Type resultType, String expression, Object[] values) +114
   Telerik.Web.UI.GridDynamicQueryable.Where(IQueryable source, String predicate, Object[] values) +208
   Telerik.Web.UI.GridDataTableFromEnumerable.FillData35() +3835
   Telerik.Web.UI.GridDataTableFromEnumerable.FillData() +1064
   Telerik.Web.UI.GridResolveEnumerable.Initialize() +58
   Telerik.Web.UI.GridResolveEnumerable.EnsureInitialized() +45
   Telerik.Web.UI.GridResolveEnumerable.get_DataTable() +31
   Telerik.Web.UI.GridEnumerableFromDataView..ctor(GridTableView owner, IEnumerable enumerable, Boolean CaseSensitive, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields) +222
   Telerik.Web.UI.GridDataSourceHelper.CreateGridEnumerable(GridTableView owner, IEnumerable enumerable, Boolean caseSensitive, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields) +155
   Telerik.Web.UI.GridDataSourceHelper.GetResolvedDataSource(GridTableView owner, Object dataSource, String dataMember, Boolean caseSensitive, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields) +566
   Telerik.Web.UI.GridTableView.get_ResolvedDataSource() +224
   Telerik.Web.UI.GridTableView.CreateChildControls(IEnumerable dataSource, Boolean useDataSource) +73
   System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +66
   System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +128
   System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +33
   System.Web.UI.WebControls.DataBoundControl.PerformSelect() +143
   Telerik.Web.UI.GridTableView.PerformSelect() +38
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +74
   Telerik.Web.UI.GridTableView.DataBind() +363
   Telerik.Web.UI.GridTableView.Rebind() +100
   Telerik.Web.UI.GridFilterCommandEventArgs.ExecuteCommand(Object source) +995
   Telerik.Web.UI.RadGrid.OnBubbleEvent(Object source, EventArgs e) +200
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
   Telerik.Web.UI.GridItem.OnBubbleEvent(Object source, EventArgs e) +61
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
   Telerik.Web.UI.GridItem.OnBubbleEvent(Object source, EventArgs e) +170
   Telerik.Web.UI.GridItem.FireCommandEvent(String commandName, Object commandArgument) +80
   Telerik.Web.UI.RadGrid.RaisePostBackEvent(String eventArgument) +9053
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +176
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1


What am I doing wrong?, it looks very simple to me

Thanks for any help in advance

8 Answers, 1 is accepted

Sort by
0
Ron
Top achievements
Rank 1
answered on 28 Oct 2010, 09:21 PM
I forgot to mention, we are trying to do also custom paging in the Grid by returning 25 records per time and setting the VirtualItemCount with the totals records that matches all the conditions
0
Pavlina
Telerik team
answered on 29 Oct 2010, 02:13 PM
Hi Ron,

Please try to set EnableLinqExpressions property of RadGrid to false and check whether this eliminates the exception.

Regards,
Pavlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Ron
Top achievements
Rank 1
answered on 29 Oct 2010, 03:27 PM
Hi Pavlina

That fixes that issue, thanks for the help

Don't know if you can help me with one additional question, is there anyway to retrieve all the sorting and filtering expressions from the grid?

thanks in advance
0
Accepted
Pavlina
Telerik team
answered on 29 Oct 2010, 04:45 PM
Hi Ron,

Check out the forum thread below and see if it helps:
http://www.telerik.com/community/forums/aspnet-ajax/grid/radgrid-filters-and-sort-columns.aspx

Kind regards,
Pavlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Ron
Top achievements
Rank 1
answered on 29 Oct 2010, 07:31 PM
Thanks a lot, you been very helpfull
0
Mithun
Top achievements
Rank 1
answered on 20 Feb 2018, 10:45 AM

 

it is work..

Thanks 

0
Gambit
Top achievements
Rank 1
answered on 11 Jan 2019, 11:33 AM

Hi,

I have a problem like the same error. I am getting the error in radgird data binding and this error is: 

An exception of type 'Telerik.Web.UI.ParseException' occurred in Telerik.Web.UI.dll but was not handled in user code
Additional information: No property or field 'FilterExpression' exists in type 'GetUnreadMessages_Result'

Code block is:

radGridMessages.DataSource = messageList;
radGridMessages.VirtualItemCount = messageList.Count();
radGridMessages.DataBind();

My code was working yesterday without using any code like EnableLinqExpressions=false. How can i solve the error in a different way or what is my actually problem?

Version Information: Microsoft .NET Framework Version:4.7.03062;

Thanks in advance.

0
Attila Antal
Telerik team
answered on 16 Jan 2019, 08:24 AM
Hi Gambit,

From the code snippets you've shared I can see that simple data binding is used for the grid which is one of the common causes for similar behavior. This binding technique works mainly for displaying data and simple scenarios. If that is the case, I advise trying the Advanced Data-binding (Using NeedDataSource Event) and ensure that DataBind() mehod is not called anywhere in the code. If the data binding technique is other than Simple Data Binding, please try removing the DataBind() method from everywhere in the code. If data needs to be refreshed in the grid, use the Rebind() method instead.

Eventually if you could share the markup of the grid and the server code related to it, that would be very helpful for us and we would be able to provide you with a more accurate information.

Please let us know if you have any questions.

Kind regards,
Attila Antal
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Grid
Asked by
Ron
Top achievements
Rank 1
Answers by
Ron
Top achievements
Rank 1
Pavlina
Telerik team
Mithun
Top achievements
Rank 1
Gambit
Top achievements
Rank 1
Attila Antal
Telerik team
Share this question
or