'''
''' Override CreateWhereClause() to filter the contents of the table
'''
Public Overrides Function CreateWhereClause() As WhereClause
' Call the MyBase.CreateWhereClause()
Dim wc As WhereClause = MyBase.CreateWhereClause()
' If MyBase.CreateWhereClause() returns nothing then create a new
' instance of WhereClause
If ( IsNothing(wc)) Then
wc = New WhereClause
End If
' Table will be filtered only once when the page loads since WhereClause is
' added only when it is not a PostBack. If you want to retain the filtering of the table
' add the whereclause outside the if condition which checks for PostBack.
If (Not Me.Page.IsPostBack) Then
wc.iAND(${${Database Table}ClassName}.${Field}, BaseFilter.ComparisonOperator.EqualsTo, "some Value",False)
return wc
Else
return wc
End If
End Function
'''
''' Override Populate${Field Filter Dropdown Control} to set the
''' selected item of the filter
'''
Protected Overrides Sub Populate${Field Filter Dropdown Control}(ByVal selectedValue As String, ByVal maxItems As Integer)
' The if condition which checks for PostBack will set the ${Field Filter Dropdown Control}
' selected value only when the page loads for the first time.
' If you want to retain the selected value of ${Field Filter Dropdown Control}
' remove the If condition which checks for the postback.
' Replace "some Value" with the value you want to set for the filter
If ( Not Me.Page.IsPostBack) Then
MyBase.Populate${Field Filter Dropdown Control}("some Value", maxItems)
Else
MyBase.Populate${Field Filter Dropdown Control}(selectedValue, maxItems)
End If
End Sub
|