'''
'''Override the Populate${Field Filter Dropdown Control} to filter its contents.
'''
Protected Overrides Sub Populate${Field Filter Dropdown Control}(ByVal selectedValue As String, ByVal maxItems As Integer)
'Set up the WHERE clause.
Dim wc As WhereClause = New WhereClause
wc.iAND(${${Parent Table}ClassName}.${Filter Field}, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, "somevalue")
' OrderBy takes two parameters
' ExpandForeignKeyColumn and isCaseSensitive
' ExpandForeignKeyColumn = true will sort the dropdown based on the display foreign key column
' and not the foreign key column.
' isCaseSensitive = true will sort the dropdown based on case sensitivity.
Dim orderBy As OrderBy = New OrderBy(False, True)
orderBy.Add(${${Parent Table}ClassName}.${Field Name},BaseClasses.Data.OrderByItem.OrderDir.Asc)
Me.${Field Filter Dropdown Control}.Items.Clear()
Dim itemValue As ${${Parent Table}RecordClassName}
For Each itemValue In ${${Parent Table}ClassName}.GetRecords(wc, orderBy, 0, maxItems)
' Create the item and add to the list.
Dim cvalue As String = itemValue.${Field Name}.ToString()
Dim fvalue As String = itemValue.Format(${${Parent Table}ClassName}.${Description Field})
Dim item As ListItem = New ListItem(fvalue, cvalue)
Me.${Field Filter Dropdown Control}.Items.Add(item)
Next
' Set the selected value.
SetSelectedValue(Me.${Field Filter Dropdown Control}, selectedValue)
' Add the All item.
Me.${Field Filter Dropdown Control}.Items.Insert(0, New ListItem(Page.GetResourceValue("Txt:All", "${Application Name}"), "--ANY--"))
End Sub
|