пытаюсь организовать свой фильтр для RadGrid-а в виде RadComboBox-а
пример взять с форума Telerik-а
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
----------------------------------
Dim ColumnName3 As String = "F5"
Dim templateColumn3 As New MyCustomFilteringColumn(xL5)
templateColumn3.DataField = "BSF5"
templateColumn3.HeaderText = "F5"
templateColumn3.UniqueName = "A5"
templateColumn3.AllowFiltering = False
Me.RadGrid1.MasterTableView.Columns.Add(templateColumn3)
------------------------------------
Public Class MyCustomFilteringColumn
Inherits GridBoundColumn
Private dsx As DataTable
Private item As XPathNodeIterator
Public Sub New(items As XPathNodeIterator)
item = items
End Sub
Protected Overrides Sub SetupFilterControls(cell As TableCell)
Dim rcBox As New RadComboBox()
rcBox.ID = ("DropDownList1" + Me.UniqueName)
rcBox.Width = Unit.Pixel(130)
rcBox.AutoPostBack = True
rcBox.DataTextField = Me.UniqueName
rcBox.DataValueField = Me.UniqueName
rcBox.DropDownAutoWidth = RadComboBoxDropDownAutoWidth.Enabled
AddHandler rcBox.SelectedIndexChanged, AddressOf rcBox_SelectedIndexChanged
For Each it As XPathNavigator In item
Dim tmp As String = it.Value.ToString()
Dim pp As New RadComboBoxItem
pp.Text = tmp
pp.Value = tmp
rcBox.Items.Add(pp)
Next
rcBox.Items.Insert(0, New RadComboBoxItem("----"))
cell.Controls.AddAt(0, rcBox)
End Sub
Protected Overrides Sub SetCurrentFilterValueToControl(cell As TableCell)
If Not (Me.CurrentFilterValue = "") Then
Dim CC As RadComboBox = DirectCast(cell.Controls(0), RadComboBox)
Dim PP As RadComboBoxItem = CC.Items.FindItemByText(Me.CurrentFilterValue.Replace(""", Chr(34)))
If PP IsNot Nothing Then PP.Selected = True
End If
End Sub
Protected Overrides Function GetCurrentFilterValueFromControl(cell As TableCell) As String
Dim currentValue As String = DirectCast(cell.Controls(0), RadComboBox).SelectedItem.Value
Me.CurrentFilterFunction = If((currentValue <> "" Or currentValue <> "----"), GridKnownFunction.EqualTo, GridKnownFunction.NoFilter)
Return currentValue.Replace(Chr(34), """) '.Replace(Chr(39), Chr(39) & Chr(39))
End Function
Private Sub rcBox_SelectedIndexChanged(sender As Object, e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs)
' DirectCast(DirectCast(sender, RadComboBox).Parent.Parent, GridFilteringItem).FireCommandEvent("Filter", New Pair())
Dim filterItem As GridFilteringItem = DirectCast(DirectCast(sender, RadComboBox).NamingContainer, GridFilteringItem)
filterItem.FireCommandEvent("Filter", New Pair("EqualTo", Me.UniqueName))
End Sub
Protected Overloads Overrides Function GetFilterDataField() As String
Return Me.DataField
End Function
Overloads Overrides Function SupportsFiltering() As Boolean
Return True
End Function
End Class
как вы всё хорошо работает
,но если в наборе данных и в фильтрах есть данные со знаком " фильтрация не работает
собственно вопрос как такое победить ?
спасибо