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

Is there a way to remove qutoe in expression for custom RadFilterDataFieldEditor?

5 Answers 71 Views
Filter
This is a migrated thread and some comments may be shown as answers.
john
Top achievements
Rank 1
john asked on 12 Sep 2012, 03:03 PM
I create a custom RadFilterDataFieldEditor. I know if the type is string, the expression will auto add two qutoe such as [Filed] = 'aaaa'. Is there a way to remove qutoe in expression such as [Filed] = aaaa?

5 Answers, 1 is accepted

Sort by
0
john
Top achievements
Rank 1
answered on 14 Sep 2012, 03:48 AM
Any solution?
0
john
Top achievements
Rank 1
answered on 14 Sep 2012, 01:55 PM
Any solution?
0
Andrey
Telerik team
answered on 17 Sep 2012, 08:31 AM
Hello,

I am not sure that I understand correctly what your requirement is. If you want to input a string value, why do you use RadFilterDateFieldEditor?

Please elaborate a bit more on your scenario, thus all the people who want to help you will have better understanding of your case and will be able to give you more precise directions.

Regards,
Andrey
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.
0
john
Top achievements
Rank 1
answered on 17 Sep 2012, 09:48 AM
In fact, I use the RadFilter to setup an expression and will replace with actual value. For example, I have a table with PV Field column and Code Field column. The left side of expression will list all PV Field and right side will list all Code Filed. The result is similar as following:
[PV Field 1] >= '[Code Filed 2]'. When I get the expression, I will replace PV Field 1 and Code Filed 2 with some actual value and then compare it. If I can remove ‘’ for '[Code Filed 2]' , it's more good for user to understand that the [Code Filed 2] is only a token not a value.

0
Andrey
Telerik team
answered on 19 Sep 2012, 02:04 PM
Hi,

You could use the following code to achieve your goal:

protected void Page_PreRenderComplete(object sender, EventArgs e)
{
    if ((RadFilter1.Controls[1] as LiteralControl).Text.Split('>').Length > 3)
    {
        if ((RadFilter1.Controls[1] as LiteralControl).Text.Split('>')[6].Split(new string[] { "</span" }, StringSplitOptions.RemoveEmptyEntries).Length > 0)
        {
            string searchedTerm = (RadFilter1.Controls[1] as LiteralControl).Text.Split('>')[6].Split(new string[] { "</span" }, StringSplitOptions.RemoveEmptyEntries)[0];
            if (searchedTerm != "''")
            {
                string newTerm = searchedTerm.Split('\'')[1];
                (RadFilter1.Controls[1] as LiteralControl).Text = (RadFilter1.Controls[1] as LiteralControl).Text.Replace(searchedTerm, newTerm);
            }
        }
    }
}

All the best,
Andrey
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
Filter
Asked by
john
Top achievements
Rank 1
Answers by
john
Top achievements
Rank 1
Andrey
Telerik team
Share this question
or