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

customfilter

2 Answers 47 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mircea
Top achievements
Rank 1
Mircea asked on 06 Jun 2012, 01:55 PM
I have created a custom filter with two datafields

on my aspx page i have
 

<custom:CustomFilter DataField1 = "Name" DataField2="LastName"  

HeaderText="Name"  

 

CurrentFilterFunction="Contains"  

 

UniqueName="UserName"  

 

AutoPostBackOnFilter="True">  

 

<ItemTemplate>  

 

<asp:Literal ID="Literal1" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Name") %>'></asp:Literal>  

 

<asp:Literal ID="Literal2" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "LastName") %>'></asp:Literal>  

 

</ItemTemplate>  

 

</custom:CustomFilter>

The issue comes when i try to use filterexpression

 

 

RadGrid1.DataSource = Data.GetAll();

 

 

 

string test = "(([LastName] LIKE \'%" + txtFilterBox.Text + "%\') OR ([Name] LIKE \'%" + txtFilterBox.Text + "%\'))";

 

RadGrid1.MasterTableView.FilterExpression = test;

RadGrid1.Rebind();

its probally wrong the way i use the filterexpression but how I should use it with 2 parameters, cant find a simmilar example :)

 

2 Answers, 1 is accepted

Sort by
0
Mircea
Top achievements
Rank 1
answered on 08 Jun 2012, 08:20 AM
hmm.. no one :(?
0
Tsvetina
Telerik team
answered on 11 Jun 2012, 12:08 PM
Hello Mircea,

What exactly the issue is? You do not get correct results or you get an exception? One thing to make sure is that you have EnableLinqExpressions="false" set in your RadGrid declaration. Alternatively, you could modify the filter expression syntax (by default Dynamic LINQ should be used). More information on the possible ways to customize your grid filterin is available here:
Operating with the FilterExpression of Telerik RadGrid Manually

Greetings,
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
Grid
Asked by
Mircea
Top achievements
Rank 1
Answers by
Mircea
Top achievements
Rank 1
Tsvetina
Telerik team
Share this question
or