Mar
31
Written by:
Steve Gray
3/31/2010 2:35 PM
This piece of code will do a 'contains' filter on a Janus grid
This code will allow multiple filter conditions
Code Snippet
- Private Sub filter()
- Dim colCustomerName As GridEXColumn
- Dim colCustomerNumber As GridEXColumn
- Dim strCustomerName As String = Me.txtCustomerName.Text
- Dim strCustomerNumber As String = Me.txtCustomerNumber.Text
-
-
- 'Get a reference of the column to be compared
- colCustomerName = GridEX1.RootTable.Columns("custname")
- colCustomerNumber = GridEX1.RootTable.Columns("custnmbr")
-
-
- 'Create the condition
- Dim condition As New GridEXFilterCondition
- If strCustomerName > "" Then
- condition.AddCondition(New GridEXFilterCondition(colCustomerName, ConditionOperator.Contains, strCustomerName))
- End If
-
-
- If strCustomerNumber > "" Then
- condition.AddCondition(New GridEXFilterCondition(colCustomerNumber, ConditionOperator.Contains, strCustomerNumber))
- End If
-
-
- ''Assign the condition to the table to filter the records
- If condition.Conditions.Count > 0 Then
- GridEX1.RootTable.FilterCondition = condition
- End If
- End Sub
As always, I welcome your comments!