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

6 posts, 0 answers
  1. john
    john avatar
    67 posts
    Member since:
    Jan 2012

    Posted 12 Sep 2012 Link to this post

    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?
  2. john
    john avatar
    67 posts
    Member since:
    Jan 2012

    Posted 13 Sep 2012 Link to this post

    Any solution?
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. john
    john avatar
    67 posts
    Member since:
    Jan 2012

    Posted 14 Sep 2012 Link to this post

    Any solution?
  5. Andrey
    Admin
    Andrey avatar
    836 posts

    Posted 17 Sep 2012 Link to this post

    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.
  6. john
    john avatar
    67 posts
    Member since:
    Jan 2012

    Posted 17 Sep 2012 Link to this post

    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.

  7. Andrey
    Admin
    Andrey avatar
    836 posts

    Posted 19 Sep 2012 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017