Hello,
I am working on a project with a RadGrid.
I need to make a custom filter.
I read your documentation and saw the instructions how to do it.
My problem is that the code works only for string type filters.
I get the following error in line 08 when I try to filter other types:
Unable to cast object of type 'Telerik.Web.UI.RadNumericTextBox'
to type 'System.Web.UI.WebControls.TextBox'.
My grid is generic (columns and data fields types are changed dynamically in run-time).
VB.NET Code:
Thank you,
Daniel
I am working on a project with a RadGrid.
I need to make a custom filter.
I read your documentation and saw the instructions how to do it.
My problem is that the code works only for string type filters.
I get the following error in line 08 when I try to filter other types:
Unable to cast object of type 'Telerik.Web.UI.RadNumericTextBox'
to type 'System.Web.UI.WebControls.TextBox'.
My grid is generic (columns and data fields types are changed dynamically in run-time).
VB.NET Code:
01.Private Sub RadGrid1_ItemCommand(sender As Object, e As GridCommandEventArgs) Handles RadGrid1.ItemCommand02. 03. 04. If e.CommandName = RadGrid.FilterCommandName Then05. Dim filterPair As Pair = CType(e.CommandArgument, Pair)06. Dim filteritem = (CType(e.Item, GridFilteringItem))07. 08. Dim textBox As TextBox = CType(filteritem(filterPair.Second.ToString()).Controls(0), TextBox)09. 'Dim textBox As CheckBox = CType(x(filterPair.Second.ToString()).Controls(0), CheckBox)10. 'Dim textBox As RadNumericTextBox = CType(x(filterPair.Second.ToString()).Controls(0), RadNumericTextBox)11. 'Dim textBox As RadDatePicker = CType(x(filterPair.Second.ToString()).Controls(0), RadDatePicker)12. 13. Dim val As String = textBox.Text14. Select Case filterPair.First15. Case "EqualTo"16. 17. 'some logic18. 19. 20. Case ""21. End Select22. 23. 24. e.Canceled = True25. 26. 27. End If28. End SubThank you,
Daniel
