This is a migrated thread and some comments may be shown as answers.
controls withing GridTemplateColumn does not filter value
8 Answers 150 Views
This is a migrated thread and some comments may be shown as answers.
Sudhanshu Tripathi
Top achievements
Rank 1
Sudhanshu Tripathi asked on 26 Jun 2010, 02:13 PM
I am using radgrid in which AllowFilteringByColumn property has set to true,
Filter in GridBoundcolumn Field works fine, but  GridTemplateColumn give error message like

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() +209
   Telerik.Web.UI.ExpressionParser.ParsePrimary() +36
   Telerik.Web.UI.ExpressionParser.ParseUnary() +365
   Telerik.Web.UI.ExpressionParser.ParseMultiplicative() +54
   Telerik.Web.UI.ExpressionParser.ParseAdditive() +54
   Telerik.Web.UI.ExpressionParser.ParseComparison() +57
   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() +228
   Telerik.Web.UI.ExpressionParser.ParsePrimaryStart() +65
   Telerik.Web.UI.ExpressionParser.ParsePrimary() +36
   Telerik.Web.UI.ExpressionParser.ParseUnary() +365
   Telerik.Web.UI.ExpressionParser.ParseMultiplicative() +54
   Telerik.Web.UI.ExpressionParser.ParseAdditive() +54
   Telerik.Web.UI.ExpressionParser.ParseComparison() +57
   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() +136
   Telerik.Web.UI.ExpressionParser.ParsePrimary() +36
   Telerik.Web.UI.ExpressionParser.ParseUnary() +365
   Telerik.Web.UI.ExpressionParser.ParseMultiplicative() +54
   Telerik.Web.UI.ExpressionParser.ParseAdditive() +54
   Telerik.Web.UI.ExpressionParser.ParseComparison() +57
   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) +187
   Telerik.Web.UI.GridDataTableFromEnumerable.FillData35() +3696
   Telerik.Web.UI.GridDataTableFromEnumerable.FillData() +1010
   Telerik.Web.UI.GridResolveEnumerable.Initialize() +55
   Telerik.Web.UI.GridResolveEnumerable.EnsureInitialized() +40
   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) +165
   Telerik.Web.UI.GridTableView.get_ResolvedDataSource() +219
   Telerik.Web.UI.GridTableView.CreateChildControls(IEnumerable dataSource, Boolean useDataSource) +73
   System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +57
   System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +114
   System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +31
   System.Web.UI.WebControls.DataBoundControl.PerformSelect() +142
   Telerik.Web.UI.GridTableView.PerformSelect() +28
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73
   Telerik.Web.UI.GridTableView.DataBind() +353
   Telerik.Web.UI.GridTableView.Rebind() +98
   Telerik.Web.UI.GridFilterCommandEventArgs.ExecuteCommand(Object source) +1002
   Telerik.Web.UI.RadGrid.OnBubbleEvent(Object source, EventArgs e) +191
   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) +165
   Telerik.Web.UI.GridItem.FireCommandEvent(String commandName, Object commandArgument) +80
   Telerik.Web.UI.RadGrid.RaisePostBackEvent(String eventArgument) +8937
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +175
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565

I am using folllowing code

 

<telerik:RadGrid ID="grdBusiness" runat="server" AutoGenerateColumns="False" AllowFilteringByColumn="True"

 

 

OnNeedDataSource="grdBusiness_NeedDataSource" BorderWidth="0px"

 

 

BorderStyle="None" OnItemCreated="grdBusiness_ItemCreated" AllowPaging="True"

 

 

PageSize="20" Width="930px">

 

 

<MasterTableView DataKeyNames="UserId" AllowFilteringByColumn="true">

 

 

<Columns>

 

 

<telerik:GridTemplateColumn HeaderText="Practice Name">

 

 

<ItemTemplate>

 

 

<asp:HyperLink ID="hypPratice" runat="server" Text='<%# Bind("PracticeName") %>'

 

 

Target="_blank"></asp:HyperLink>

 

 

</ItemTemplate>

 

 

</telerik:GridTemplateColumn>

 

 

<telerik:GridTemplateColumn HeaderText="Name">

 

 

<ItemTemplate>

 

 

<asp:Label ID="lblName" runat="server" Text='<%# Eval("FirstName")+" "+Eval("LastName") %>'></asp:Label>

 

 

</ItemTemplate>

 

 

</telerik:GridTemplateColumn>

 

 

<telerik:GridBoundColumn DataField="Email" HeaderText="Email Id" AllowFiltering="true">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="Phone" HeaderText="Phone No">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="Website" HeaderText="Website">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridTemplateColumn HeaderText="Lic No" AllowFiltering="false">

 

 

<ItemTemplate>

 

 

<asp:Label ID="lblLicenseNo" runat="server"></asp:Label>

 

 

</ItemTemplate>

 

 

</telerik:GridTemplateColumn>

 

 

<telerik:GridTemplateColumn AllowFiltering="false" HeaderText="Exp">

 

 

<ItemTemplate>

 

 

<asp:Label ID="lblTotalExp" runat="server"></asp:Label>

 

 

</ItemTemplate>

 

 

</telerik:GridTemplateColumn>

 

 

<telerik:GridTemplateColumn HeaderText="Plan Name" AllowFiltering="false">

 

 

<ItemTemplate>

 

 

<div>

 

 

<div>

 

 

<asp:Label ID="lblPlanName" runat="server"></asp:Label>

 

 

</div>

 

 

<asp:HyperLink ID="hypFreeLifeTime" runat="server"></asp:HyperLink>

 

 

</div>

 

 

</ItemTemplate>

 

 

</telerik:GridTemplateColumn>

 

 

</Columns>

 

 

</MasterTableView>

 

 

<HeaderStyle CssClass="ItemAlignment" Font-Names="Arial" />

 

 

<ItemStyle CssClass="ItemAlignment" />

 

 

<AlternatingItemStyle CssClass="ItemAlignment" />

 

 

</telerik:RadGrid>

 


it means when filter apply on PracticeName and name field each time the above message display,
what i have done worng, i m not analyzing ,
pz ry..............

8 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 28 Jun 2010, 07:44 AM
Hello Sudhanshu,

Try setting DataField of your GridTemplateColumn and let me know how it goes.

Best wishes,
Nikolay
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
Sudhanshu Tripathi
Top achievements
Rank 1
answered on 28 Jun 2010, 09:38 AM
Hi Nikolay,
               thnx for ry, After setting datafield value filter is working fine.
              One of my question is that i have a column with field 'Name'  which is combination of two field(firstname + lastname), when i am using filtering then it does not work. my code is like

<

 

telerik:GridTemplateColumn HeaderText="Name" >

 

 

<ItemTemplate>

 

 

<asp:Label ID="lblName" runat="server" Text='<%# Eval("FirstName")+" "+Eval("LastName") %>'></asp:Label>

 

 

</ItemTemplate>

 

 

</telerik:GridTemplateColumn>

i m getting the same error that mention in above thread,

 

0
Nikolay Rusev
Telerik team
answered on 29 Jun 2010, 02:54 PM
Hello Sudhanshu,

You cannot directly filter on two field(firstname + lastname). To achieve this you must have property in RadGrid DataSource that contains the combined value of both fields.

Greetings,
Nikolay
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
Mohan
Top achievements
Rank 1
answered on 11 Mar 2011, 08:47 AM
Hello Nikolay

Thank you very much
0
zozzancs
Top achievements
Rank 1
answered on 31 Mar 2011, 03:31 PM
Hello,

Same error here
My filtered column is a GridCheckBoxColumn. I want to filter the rows which are note "done" which means that the checkboxcolumn value should be False.
I did set the datafield.

<MasterTableView AutoGenerateColumns="False" DataKeyNames="guid" DataSourceID="worksheetSqlDataSource"
AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" FilterExpression="([done] = False)">
 
...
 
<telerik:GridCheckBoxColumn DataField="done" DataType="System.Boolean" HeaderText="Done" AutoPostBackOnFilter="true" CurrentFilterFunction="EqualTo" ReadOnly="true" SortExpression="done" UniqueName="done">
</telerik:GridCheckBoxColumn>
0
Radoslav
Telerik team
answered on 04 Apr 2011, 11:09 AM
Hello Zozzancs,

Could you please try setting the RadGrid.EnableLinqExpressions property to false and let me know if the issue still exists:
<telerik:RadGrid runat="server" ID="RadGrid1"  EnableLinqExpressions="False">
..


Regards,
Radoslav
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
zozzancs
Top achievements
Rank 1
answered on 04 Apr 2011, 01:08 PM
That is the solution!

Thank you, Radoslav!
0
neb
Top achievements
Rank 1
answered on 06 May 2014, 03:11 PM
This helped. thanks.
Tags
Grid
Asked by
Sudhanshu Tripathi
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Sudhanshu Tripathi
Top achievements
Rank 1
Mohan
Top achievements
Rank 1
zozzancs
Top achievements
Rank 1
Radoslav
Telerik team
neb
Top achievements
Rank 1
Share this question
or