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

Immediate Filtering Problem

3 Answers 26 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 23 Oct 2014, 01:07 PM
Hello,

I am working on a project with RadGrid.
I'm trying to implement a filter like the following example:
Filtering with Client-Side Binding

I want the Grid values to change according to the text which the user is typing in the filter Textbox.
In my Project I use a DataTable as a data source.

How can I do this?

My code:
01.Public Class Grid_Filter_Client
02.    Inherits System.Web.UI.Page
03.    Dim dd As New DummyData
04.    Dim dt As New DataTable
05.    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
06. 
07.        If Not IsPostBack Then
08. 
09.            SetGridProp(RadGrid1, True)
10.        Else
11. 
12.        End If
13. 
14. 
15.    End Sub
16. 
17.    Private Sub SetGridProp(ByRef grd, ByVal auto)
18.        dt = dd.GenTableData2
19.        grd.AllowFilteringByColumn = True
20.        grd.FilterType = GridFilterType.CheckList
21.        grd.MasterTableView.PagerStyle.AlwaysVisible = True
22.        grd.AllowSorting = True
23. 
24.        ''''''''''''''''''
25.        'grd.MasterTableView.CheckListWebServicePath = "dt"
26. 
27.        If auto Then
28.            grd.MasterTableView.AutoGenerateColumns = False
29. 
30.            grd.MasterTableView.DataKeyNames = {dt.Columns(0).ColumnName}
31.            grd.MasterTableView.ClientDataKeyNames = {dt.Columns(0).ColumnName}
32. 
33.            Dim GridBoundCol As GridBoundColumn
34.            For index = 0 To dt.Columns.Count - 1
35.                GridBoundCol = New GridBoundColumn
36.                GridBoundCol.FilterDelay = 200
37.                GridBoundCol.FilterCheckListWebServiceMethod = dt.Columns(index).ColumnName
38.                GridBoundCol.DataField = dt.Columns(index).ColumnName
39.                GridBoundCol.HeaderText = dt.Columns(index).ColumnName
40.                grd.MasterTableView.Columns.Add(GridBoundCol)
41. 
42.            Next
43. 
44. 
45.            grd.DataSource = dt
46. 
47.            ''''''''''''''''''''
48.            'grd.ClientSettings.DataBinding.SelectMethod = ""
49.            'grd.ClientSettings.DataBinding.Location = ""
50.            grd.ClientSettings.DataBinding.SortParameterType = GridClientDataBindingParameterType.Linq
51.            grd.ClientSettings.DataBinding.FilterParameterType = GridClientDataBindingParameterType.Linq
52.        End If
53.    End Sub
54.   
55. 
56.    Private Sub RadGrid1_NeedDataSource(sender As Object, e As GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource
57.        dt = dd.GenTableData2
58.        RadGrid1.DataSource = dt
59.    End Sub
60. 
61.     
62.    
63.End Class

Currently when I try to filter, the grid’s data doesn’t changed.

Another problem that I have is that sometimes when I delete the whole text from the filter textbox, all cells’ values are replaced with “System.Data.DataRowView”

P.S.  I've included a video that shows the problems I have.
http://youtu.be/0-FSvR5t-wQ

 Thanks,
Daniel

3 Answers, 1 is accepted

Sort by
0
Accepted
Eyup
Telerik team
answered on 28 Oct 2014, 09:54 AM
Hi Daniel,

I'm sending a sample RadGrid web site to demonstrate how you can achieve the requested functionality. Please run the attached application and let me know if it helps you.

In case you do not use paging, you can also check the following code-library:
http://www.telerik.com/support/code-library/quick-search---filtering-rows-depending-on-entered-text-instantly-when-paging-is-disabled

Regards,
Eyup
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Daniel
Top achievements
Rank 1
answered on 30 Oct 2014, 09:46 AM
Hi Eyup,

Thanks so much for all the code you’ve provided!! It works fine!

I wanted to ask if I can add a text filter option to the project you’ve sent, as appears here:
http://designshack.net/tutorialexamples/html5-autocomplete-suggestions/
When the user enters a Character in TextBox, it is highlighted in the drop-down.

Thank you,
Daniel.
0
Eyup
Telerik team
answered on 04 Nov 2014, 10:56 AM
Hello Daniel,

To achieve this requirement, you can use RadComboBox:
http://demos.telerik.com/aspnet-ajax/combobox/examples/overview/defaultcs.aspx

In combination with FilterTemplates:
http://demos.telerik.com/aspnet-ajax/grid/examples/functionality/filtering/filter-templates/defaultcs.aspx

Hope this helps.

Regards,
Eyup
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Daniel
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Daniel
Top achievements
Rank 1
Share this question
or