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

filter in grid failing to capture special characters < > =

3 Answers 250 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Minh
Top achievements
Rank 1
Minh asked on 15 May 2012, 10:20 PM
Hi,

I'm working w/ the radgrid. The grid has a column that contains special characters such as

'< 5 MMBtu'
'>130hp'

during filtering, the grid will fail to filter any values that contain '>', '<', and '='

...I'm using the filter clause 'Contains', 'Starts with', 'Equal to'

please advise.

thanks,
Minh Bui

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 16 May 2012, 05:44 AM
Hello MInh,

With reference to this forum thread, filtering in RadGrid  with " LIKE ", " AND ", " OR ", "\"", ">", "<", "<>", " NULL ", " IS " and '';" is said to be unsupported.

Thanks,
Shinu.
0
Minh
Top achievements
Rank 1
answered on 17 May 2012, 07:53 PM
Hi,

I was trying to build a custom filter that will allow me to search for a specified string that contains special characters..I took the example from the online documention....I was hoping that someone would guide me through the rest of the way..

 

 

protected void GridChevronPortEQ_ItemCommand(object sender, GridCommandEventArgs e)

 

{

 

 

if (e.CommandName == RadGrid.FilterCommandName)

 

{

 

 

Pair filterPair = (Pair)e.CommandArgument;

 

 

 

if (filterPair.First.ToString() == "Contains")

 

{

 

 

string colName = filterPair.Second.ToString();

 

 

 

TextBox tbPattern = (e.Item as GridFilteringItem)[colName].Controls[0] as TextBox;

 

 

 

string[] values = tbPattern.Text.Split(' ');

 

 

 

if (values.Length == 2)

 

{

e.Canceled =

 

true;

 

 

 

string newFilter = "(([" + filterPair.Second + "] >='" + values[0] + "') AND ([" + filterPair.Second + "] <='" + values[1] + "'))";

 

 

 

if (GridChevronPortEQ.MasterTableView.FilterExpression == "")

 

{

GridChevronPortEQ.MasterTableView.FilterExpression = newFilter;

}

 

 

else

 

{

GridChevronPortEQ.MasterTableView.FilterExpression =

 

"((" + GridChevronPortEQ.MasterTableView.FilterExpression + ") AND (" + newFilter + "))";

 

}

GridChevronPortEQ.Rebind();

}

}

}

}

0
Pavlina
Telerik team
answered on 22 May 2012, 02:28 PM
Hello Minh,

I believe that the forum thread below will help you in resolving this problem:
http://www.telerik.com/community/forums/aspnet-ajax/grid/grid-mastertableview-filterexpression-is-blank-on-special-chars-like-quot-lt-gt-is-passed-from-google-like-filtering.aspx

All the best,
Pavlina
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
Minh
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Minh
Top achievements
Rank 1
Pavlina
Telerik team
Share this question
or