or
001.Public Class Google_Like_Filter2002. Inherits System.Web.UI.Page003. Dim dd As New DummyData004. Dim dt As New DataTable005. Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load006. If Not IsPostBack Then007. dt = dd.GenTableData2008. Me.RadGrid1.MasterTableView.Columns.Clear()009. 010. For Each dataColumn As DataColumn In dt.Columns011. Dim gridColumn As New MyCustomFilteringColumnVB()012. Me.RadGrid1.MasterTableView.Columns.Add(gridColumn)013. gridColumn.DataField = dataColumn.ColumnName014. gridColumn.HeaderText = dataColumn.ColumnName015. Next016. End If017. End Sub018. 019. Private Sub RadGrid1_ColumnCreating(sender As Object, e As Telerik.Web.UI.GridColumnCreatingEventArgs) Handles RadGrid1.ColumnCreating020. If (e.ColumnType = GetType(MyCustomFilteringColumnVB).Name) Then021. e.Column = New MyCustomFilteringColumnVB()022. End If023. End Sub024. 025. Private Sub RadGrid1_ItemCommand(sender As Object, e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.ItemCommand026. If (e.CommandName = "Filter") Then027. For Each column As GridColumn In e.Item.OwnerTableView.Columns028. column.CurrentFilterValue = String.Empty029. column.CurrentFilterFunction = GridKnownFunction.NoFilter030. Next031. End If032. End Sub033. 034. Private Sub RadGrid1_NeedDataSource(sender As Object, e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource035. RadGrid1.DataSource = dt036. 037. End Sub038.End Class039. 040.Public Class MyCustomFilteringColumnVB041. Inherits GridBoundColumn042. Dim dd As New DummyData043. 'RadGrid will call this method when it initializes the controls inside the filtering item cells044. Protected Overloads Overrides Sub SetupFilterControls(ByVal cell As TableCell)045. MyBase.SetupFilterControls(cell)046. cell.Controls.RemoveAt(0)047. Dim combo As New RadComboBox()048. combo.ID = ("RadComboBox1" + Me.UniqueName)049. combo.ShowToggleImage = False050. combo.Skin = "Office2007"051. combo.EnableLoadOnDemand = True052. combo.AutoPostBack = True053. combo.MarkFirstMatch = False054. combo.Height = Unit.Pixel(100)055. combo.EnableAutomaticLoadOnDemand = False056. AddHandler combo.ItemsRequested, AddressOf Me.list_ItemsRequested057. AddHandler combo.SelectedIndexChanged, AddressOf Me.list_SelectedIndexChanged058. cell.Controls.AddAt(0, combo)059. cell.Controls.RemoveAt(1)060. End Sub061. 'RadGrid will cal this method when the value should be set to the filtering input control(s)062. Protected Overloads Overrides Sub SetCurrentFilterValueToControl(ByVal cell As TableCell)063. MyBase.SetCurrentFilterValueToControl(cell)064. Dim combo As RadComboBox = DirectCast(cell.Controls(0), RadComboBox)065. If (Me.CurrentFilterValue <> String.Empty) Then066. combo.Text = Me.CurrentFilterValue067. End If068. End Sub069. 'RadGrid will cal this method when the filtering value should be extracted from the filtering input control(s)070. Protected Overloads Overrides Function GetCurrentFilterValueFromControl(ByVal cell As TableCell) As String071. Dim combo As RadComboBox = DirectCast(cell.Controls(0), RadComboBox)072. Return combo.Text073. End Function074. Private Sub list_ItemsRequested(ByVal o As Object, ByVal e As RadComboBoxItemsRequestedEventArgs)075. Dim dt As DataTable = dd.GenTableData2076. CType(o, RadComboBox).DataTextField = Me.DataField077. CType(o, RadComboBox).DataValueField = Me.DataField078. 'If (Me.ColumnType Is GetType(String)) Then079. 080. 'dt = dt.Select(String.Format(Me.UniqueName + " LIKE '*{0}*'", e.Text)).CopyToDataTable081. dt = dt.Select(Me.UniqueName + " LIKE '%" + e.Text + "%'").CopyToDataTable082. Dim dv As DataView = New DataView(dt)083. dt = dv.ToTable("dt", False, Me.UniqueName)084. ''Else085. 'End If086. 087. 088. 089. CType(o, RadComboBox).DataSource = dt090. 091. CType(o, RadComboBox).DataBind()092. End Sub093. 094. Private Sub list_SelectedIndexChanged(ByVal o As Object, ByVal e As RadComboBoxSelectedIndexChangedEventArgs)095. Dim filterItem As GridFilteringItem = DirectCast((DirectCast(o, RadComboBox)).NamingContainer, GridFilteringItem)096. If (Me.UniqueName = "Index") Then097. 'If (Me.ColumnType Is GetType(Integer)) Then098. 'this is filtering for integer column type099. filterItem.FireCommandEvent("Filter", New Pair("EqualTo", Me.UniqueName))100. End If101. 'filtering for string column type102. filterItem.FireCommandEvent("Filter", New Pair("Contains", Me.UniqueName))103. End Sub104.End Class105. 106.Public Class DummyData107. Public Function GenTableData2(Optional records = 30)108. Dim dt As New DataTable109. dt.Columns.Add("ID", GetType(Integer))110. dt.Columns.Add("First", GetType(String))111. dt.Columns.Add("Last", GetType(String))112. dt.Columns.Add("Birth", GetType(DateTime))113. 114. 115. For index = 1 To records116. dt.Rows.Add(index, "First" & index, "Last" & index, Date.Now.AddDays(-index))117. Next118. 119. Return dt120. End Function121.End Classfunction AddNewEntry(pText, pDisabled) { var autoCompleteBox = $find("<%=RdtCmpltBx_Data.ClientID %>"); var entry = new Telerik.Web.UI.AutoCompleteBoxEntry(); entry.set_text(pText); autoCompleteBox.get_entries().add(entry); if (pDisabled == true) { var token = entry.get_token(); token.isDisabled = true; }}<div style="display: table-cell; vertical-align: middle; padding-top: 5px; padding-left: 5px; padding-bottom: 5px; padding-right: 5px;"> <telerik:RadAutoCompleteBox ID="RdtCmpltBx_Data1" runat="server" WebServiceSettings-Method="GetSingleData" WebServiceSettings-Path="Main.aspx" OnClientTextChanged="DataChanged" Filter="StartsWith" DropDownPosition="Automatic" AllowCustomEntry="true" InputType="Text" TextSettings-SelectionMode="Single" /></div>

01.Public Class Grid_Filter_Client02. Inherits System.Web.UI.Page03. Dim dd As New DummyData04. Dim dt As New DataTable05. Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load06. 07. If Not IsPostBack Then08. 09. SetGridProp(RadGrid1, True)10. Else11. 12. End If13. 14. 15. End Sub16. 17. Private Sub SetGridProp(ByRef grd, ByVal auto)18. dt = dd.GenTableData219. grd.AllowFilteringByColumn = True20. grd.FilterType = GridFilterType.CheckList21. grd.MasterTableView.PagerStyle.AlwaysVisible = True22. grd.AllowSorting = True23. 24. ''''''''''''''''''25. 'grd.MasterTableView.CheckListWebServicePath = "dt"26. 27. If auto Then28. grd.MasterTableView.AutoGenerateColumns = False29. 30. grd.MasterTableView.DataKeyNames = {dt.Columns(0).ColumnName}31. grd.MasterTableView.ClientDataKeyNames = {dt.Columns(0).ColumnName}32. 33. Dim GridBoundCol As GridBoundColumn34. For index = 0 To dt.Columns.Count - 135. GridBoundCol = New GridBoundColumn36. GridBoundCol.FilterDelay = 20037. GridBoundCol.FilterCheckListWebServiceMethod = dt.Columns(index).ColumnName38. GridBoundCol.DataField = dt.Columns(index).ColumnName39. GridBoundCol.HeaderText = dt.Columns(index).ColumnName40. grd.MasterTableView.Columns.Add(GridBoundCol)41. 42. Next43. 44. 45. grd.DataSource = dt46. 47. ''''''''''''''''''''48. 'grd.ClientSettings.DataBinding.SelectMethod = ""49. 'grd.ClientSettings.DataBinding.Location = ""50. grd.ClientSettings.DataBinding.SortParameterType = GridClientDataBindingParameterType.Linq51. grd.ClientSettings.DataBinding.FilterParameterType = GridClientDataBindingParameterType.Linq52. End If53. End Sub54. 55. 56. Private Sub RadGrid1_NeedDataSource(sender As Object, e As GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource57. dt = dd.GenTableData258. RadGrid1.DataSource = dt59. End Sub60. 61. 62. 63.End Class