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

Google Like Filtering

3 Answers 50 Views
Filter
This is a migrated thread and some comments may be shown as answers.
Ramalakshmi VG
Top achievements
Rank 1
Ramalakshmi VG asked on 06 Jan 2012, 11:24 AM
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)

3 Answers, 1 is accepted

Sort by
0
Vasil
Telerik team
answered on 09 Jan 2012, 12:42 PM
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
0
Ramalakshmi VG
Top achievements
Rank 1
answered on 12 Jan 2012, 05:12 AM
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.
0
Tsvetina
Telerik team
answered on 12 Jan 2012, 03:08 PM
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
Tags
Filter
Asked by
Ramalakshmi VG
Top achievements
Rank 1
Answers by
Vasil
Telerik team
Ramalakshmi VG
Top achievements
Rank 1
Tsvetina
Telerik team
Share this question
or