Lamees Afify
Top achievements
Rank 1
Lamees Afify
asked on 16 Sep 2008, 12:49 PM
Hey,$0 I have a problem when trying to filter on "Contains" condition. The datacolumn in the database is of type int and I bound the datafield to a GridViewTextBoxColumn in the RadGrid. When I try to make a filter on Contains condition and once I type a number I got an error Cannot perform 'Like' operation on System.Int32 and System.String$0$0$0$0$0Is there anyway to fix that?$0
9 Answers, 1 is accepted
0
Hi Lamees Afify,
Thank you for your question.
Then you can modify the filter using this code:
Feel free to contact me if you have any further questions.
Best wishes,
Nick
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Thank you for your question.
There is a work-around for this issue. You have to create a hidden string column:
GridViewTextBoxColumn c = new GridViewTextBoxColumn(); |
c.DataType = typeof(string); |
c.IsVisible = false; |
this.radGridView1.MasterGridViewTemplate.Columns.Add(c); |
c.Expression = "databasefieldhere"; |
Please take care of adding this column just once, because the grid will consume too much memory.
Then you have to create a custom filter:
FilterExpression filter = new FilterExpression(FilterExpression.BinaryOperation.AND, GridKnownFunction.Contains, GridFilterCellElement.ParameterName); |
ParameterValuePair p = new ParameterValuePair(GridFilterCellElement.ParameterName, "99"); |
filter.Parameters.Add(p); c.Filter=Filter;
|
Then you can modify the filter using this code:
p.Value="filtervalue" |
Feel free to contact me if you have any further questions.
Best wishes,
Nick
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Lamees Afify
Top achievements
Rank 1
answered on 19 Sep 2008, 12:47 PM
hey,
Thanks for your reply, but whre should I add the line where I change the parameter value p.Value="filtervalue" ?
Thanks again
Thanks for your reply, but whre should I add the line where I change the parameter value p.Value="filtervalue" ?
Thanks again
0
Hi Lamees Afify,
You should do that in the second code snippet, where the filter value is set to the string 99. You may change this value at any time in your code using the third snippet. For example, you may change the filter value to the string 17 using this code:
Don't hesitate to contact me if you have further questions.
Greetings,
Nick
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
You should do that in the second code snippet, where the filter value is set to the string 99. You may change this value at any time in your code using the third snippet. For example, you may change the filter value to the string 17 using this code:
p.Value="17" |
Don't hesitate to contact me if you have further questions.
Greetings,
Nick
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Samira
Top achievements
Rank 1
answered on 19 Feb 2014, 08:37 AM
Hi,
The value of column's filter descriptor disappeared after filtering. How can i fix it ?
The value of column's filter descriptor disappeared after filtering. How can i fix it ?
0
Hello Samira,
Thank you for contacting us.
The provided information is not enough for me to reproduce the problem on my end. The value in the filter cell is stored after filtering. Please refer to the attached screen shot. Could you please specify the exact steps how to reproduce the problem or get back to me with a sample code snippet so I can investigate the precise case? Information about the installed Telerik UI for WinForms version will be useful. Thank you in advance.
I am looking forward to your reply.
Regards,
Desislava
Telerik
Thank you for contacting us.
The provided information is not enough for me to reproduce the problem on my end. The value in the filter cell is stored after filtering. Please refer to the attached screen shot. Could you please specify the exact steps how to reproduce the problem or get back to me with a sample code snippet so I can investigate the precise case? Information about the installed Telerik UI for WinForms version will be useful. Thank you in advance.
I am looking forward to your reply.
Regards,
Desislava
Telerik
0
Samira
Top achievements
Rank 1
answered on 22 Feb 2014, 12:04 PM
Hello Desislava,
I wanted to filter a numeric column so I added a hidden column to the grid . When user entered the filter value in main column, the grid filtered but filter value at main column disappeared.
I wanted to filter a numeric column so I added a hidden column to the grid . When user entered the filter value in main column, the grid filtered but filter value at main column disappeared.
0
Hello Samira,
Thank you for writing back.
I am still unable to reproduce the problem on my end with the latest version. I would kindly ask you to provide same code snippet, which successfully reproduces the issue. Thus, we would be able to investigate the specific case and assist you further. Thank you in advance for the co-operation.
I am looking forward to your reply.
Regards,
Desislava
Telerik
Thank you for writing back.
I am still unable to reproduce the problem on my end with the latest version. I would kindly ask you to provide same code snippet, which successfully reproduces the issue. Thus, we would be able to investigate the specific case and assist you further. Thank you in advance for the co-operation.
I am looking forward to your reply.
Regards,
Desislava
Telerik
0
Samira
Top achievements
Rank 1
answered on 01 Mar 2014, 10:45 AM
Hello Desislava,
Thank you for your attention.
I wanted to use contain filter for numeric column so I used Nick's way and created a hidden string column to the grid.
But when I filter Numeric column by contain filter and apply it on hidden string column , The value of column's filter descriptor disapeared.
Thank you for your attention.
I wanted to use contain filter for numeric column so I used Nick's way and created a hidden string column to the grid.
But when I filter Numeric column by contain filter and apply it on hidden string column , The value of column's filter descriptor disapeared.
0
Hello Samira,
Thank you for writing back.
I would like to note that Nick's solution is relevant for the specified version (Q2 2008 SP1). Currently, our RadGridView is quite improved compared to 2008.
Your question has already been answered in the forum thread you have opened. Please, see our answer there for more information. We kindly ask you to use just one thread for a specific problem.
Thank you for your understanding.
Regards,
Desislava
Telerik
Thank you for writing back.
I would like to note that Nick's solution is relevant for the specified version (Q2 2008 SP1). Currently, our RadGridView is quite improved compared to 2008.
Your question has already been answered in the forum thread you have opened. Please, see our answer there for more information. We kindly ask you to use just one thread for a specific problem.
Thank you for your understanding.
Regards,
Desislava
Telerik
DevCraft Q1'14 is here! Join the free online conference to see how this release solves your top-5 .NET challenges. Reserve your seat now!