Google Like Filtering

4 posts, 0 answers
  1. Ramalakshmi VG
    Ramalakshmi VG avatar
    4 posts
    Member since:
    Aug 2009

    Posted 06 Jan 2012 Link to this post

    We are using Google like Filtering for the columns in a grid. The Filtering works fine for all the columns except for two columns which are displaying dates. The Format for the column in the Grid as well as the format for the date in the RadCombo(used for type ahead) is

    "{0:dd-MMM-yyyy}".
    Please suggest a solution.We are using a class file for this which is like your Demo File (CustomFilteringColumn.cs)

  2. Vasil
    Admin
    Vasil avatar
    1547 posts

    Posted 09 Jan 2012 Link to this post

    Hi Ramalakshmi,

    This limitation comes from the SQL LIKE condition that can't be used for DateTime objects. See this forum for eventual solutions.
    http://stackoverflow.com/questions/1629050/sql-server-datetime-like-select

    You could try to modify the SQL query used in the list_ItemsRequested function of CustomFilteringColumn, according to the suggestions of the users in the forum posted above.

    I hope this helps.

    All the best,
    Vasil
    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Ramalakshmi VG
    Ramalakshmi VG avatar
    4 posts
    Member since:
    Aug 2009

    Posted 11 Jan 2012 Link to this post

    There is another issue related to applying some default Filter condition on Page Load. We are using Google Type Filtering and I want to apply a default filter. Can you suggest a way to do this.
  5. Tsvetina
    Admin
    Tsvetina avatar
    1875 posts

    Posted 12 Jan 2012 Link to this post

    Hi Ramalakshmi,

    I just answered your support ticket with this question. Please, if you have any questions about the suggested solution, post them there, so that we avoid duplicate posts.

    Here is what is the suggestion:
    You should be able to do it the same way as with regular grid columns. Here is how I made out Google-like filtering demo put a default filter for Country=Germany:
    Copy Code
    protected void RadGrid1_PreRender(object sender, EventArgs e)
    {
    if (!IsPostBack)
    {
    RadGrid1.MasterTableView.FilterExpression = "(Convert.ToString(it[\"Country\"]) = \"Germany\")";
    GridColumn column = RadGrid1.MasterTableView.GetColumnSafe("Country");
    column.CurrentFilterFunction = GridKnownFunction.Contains;
    column.CurrentFilterValue = "Germany";
    RadGrid1.MasterTableView.Rebind();
    }
    }

    In case you have disabled linq expressions, use
    "([Country] LIKE \'%Germany%\') "
    for a filter expression.

    More on creating filter expressions you can find here:
    http://www.telerik.com/help/aspnet-ajax/grid-operate-with-filter-expression-manually.html

    I hope this helps.


    Kind regards,
    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
Back to Top