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

Google style filtering on RadGrid

1 Answer 95 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 2
dlamprey asked on 13 Nov 2008, 05:04 PM
I have followed the tutorial on Google Style filtering for a column, and have it working, but am coming across a few problems.

  1. It doesn't work on all datasources, such as generic lists.
  2. It doesn't work on stored procedures.
  3. It doesn't work on all queries, such as ones with order by statements.
  4. It doesn't work on select statements that use parameters.
  5. It's vulnerable to sql injection, and throws exceptions on the demo if you enter a single quote. (this is an easy fix)
  6. it requires an additional database call for data that is already in memory.

Has anyone found a solution to these issues, or a more elegant way of getting this to work?

1 Answer, 1 is accepted

Sort by
Nikolay Rusev
Telerik team
answered on 18 Nov 2008, 02:32 PM
Hello dlamprey,

You can find the Google like filtering demo ready to use here:
"Google suggest" style filtering in RadGrid.

Have in mind that this is just a demo demonstrating how you can integrate RadGrid in real life application.
You are free to customize or optimize anything form the code of the demo.

The link below shows to what kind of data source you bind RadGrid:
Various data sources

Regarding the sql injection vulnerability you should replace the following line in RadComboBox.ItemRequested event
CType(o, RadComboBox).DataSource = GetDataTable("SELECT DISTINCT " & Me.UniqueName & " FROM Customers WHERE " & Me.UniqueName & " LIKE '" & e.Text & "%'") 

with this instead:
CType(o, RadComboBox).DataSource = GetDataTable("SELECT DISTINCT " & Me.UniqueName & " FROM Customers WHERE " & Me.UniqueName & " LIKE '" & e.Text.Replace("'", "''") & "%'") 

I hope this helps.

Kind regards,
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Asked by
Top achievements
Rank 2
Answers by
Nikolay Rusev
Telerik team
Share this question