Special characters should be validated in the grid view filter cell & Custom filter dialog from context menu
I tried the following ways and it was successful for Rad grid view filter cell
I tried validating in filter changing event while the user enters in the filter cell
If (grid.IsInEditMode = True) Then
If (grid.ActiveEditor.Value IsNot Nothing) Then
Dim strFilterCellValue As String = grid.ActiveEditor.Value
If (strFilterCellValue.Contains("*") Or strFilterCellValue.Contains("[")) Then
Dim lastIndexOfFilterCell As Integer = strFilterCellValue.Count - 1
Dim strNewFilterCellValue As String = strFilterCellValue.Remove(lastIndexOfFilterCell, 1)
grid.ActiveEditor.Value = strNewFilterCellValue
grid.CurrentCell.Editor.BeginEdit()
Return 1
Exit Function
End If
End If
End If
And for Custom filter menu
If (cellValue IsNot Nothing) Then
Dim totalCount As Integer = cellValue.Count
If (cellValue.Contains("*")) Then
Dim indexOfStar As String = cellValue.IndexOf("*")
Dim numOfCharsRemoved As String = totalCount - indexOfStar
Dim strNewFilterCellValue As String = cellValue.Remove(indexOfStar, numOfCharsRemoved)
grid.CurrentCell.Value = strNewFilterCellValue
grid.MasterGridViewTemplate.FilterExpressions.EndItemUpdate()
Return 2
Exit Function
End If
If (cellValue.Contains("[")) Then
Dim indexOfOpenBracket As String = cellValue.IndexOf("[")
Dim numOfCharsRemoved As String = totalCount - indexOfOpenBracket
Dim strNewFilterCellValue As String = cellValue.Remove(indexOfOpenBracket, numOfCharsRemoved)
grid.CurrentCell.Value = strNewFilterCellValue
grid.MasterGridViewTemplate.FilterExpressions.EndItemUpdate()
Return 2
Exit Function
End If
The issue is I m unable to validate both together that is for custom filter option & while the user enters in the filter cell
Thanks,
Julian