Using the below data, I can Sort but cannot filter on any of the columns which are populated based on a foreignKey. As you can see in ietmsCreated, I'm only loading into my Filerting Combobox, those countries which are already associated with a given Recipientorganization. This works fine, however, when I click on one of the countries in the Comboxbox, the Grid always refresehs and appears empty.
Ideas?
Private
Sub
RecipientsGrid_NeedDataSource(sender
As
Object
, e
As
Telerik.Web.UI.GridNeedDataSourceEventArgs)
Handles
RecipientsGrid.NeedDataSource
Dim
ctx
As
New
DataEntities
RecipientsGrid.DataSource = ctx.RecipientOrganizations.ToList
End
Sub
Private
Sub
RecipientsGrid_ItemCreated(sender
As
Object
, e
As
Telerik.Web.UI.GridItemEventArgs)
Handles
RecipientsGrid.ItemCreated
If
TypeOf
e.Item
Is
GridFilteringItem
Then
'CustomFilters
Dim
item
As
GridFilteringItem =
CType
(e.Item, GridFilteringItem)
'** Country **
Dim
FilterCountry
As
RadComboBox =
CType
(item.FindControl(
"FilterCountry"
), RadComboBox)
Using ctx
As
New
DataEntities
With
FilterCountry
.DataSource = ctx.RecipientOrganizations.
Select
(
Function
(x) x.Country).Distinct.ToList
End
With
FilterCountry.Width = Unit.Pixel(80)
End
Using
'** Country **
End
If
End
Sub
<
telerik:GridBoundColumn
DataField
=
"Country.CountryName"
FilterControlAltText
=
"Filter Country column"
HeaderText
=
"Country"
HeaderStyle-Width
=
"170"
FilterControlWidth
=
"170"
SortExpression
=
"Country.CountryName"
UniqueName
=
"Country"
>
<
FilterTemplate
>
<
telerik:RadComboBox
ID
=
"FilterCountry"
Height
=
"100px"
AppendDataBoundItems
=
"true"
DataValueField
=
"CountryId"
DataTextField
=
"CountryName"
SelectedValue='<%# TryCast(Container,GridItem).OwnerTableView.GetColumn("Country").CurrentFilterValue %>'
runat="server" OnClientSelectedIndexChanged="FilterCountryChanged" >
<
Items
>
<
telerik:RadComboBoxItem
Text
=
"All"
/>
</
Items
>
</
telerik:RadComboBox
>
<
telerik:RadScriptBlock
ID
=
"CountryFilterScript"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
function FilterCountryChanged(sender, args) {
var tableView = $find("<%# TryCast(Container,GridItem).OwnerTableView.ClientID %>");
tableView.filter("Country", args.get_item().get_value(), "EqualTo");
}
</
script
>
</
telerik:RadScriptBlock
>
</
FilterTemplate
>
</
telerik:GridBoundColumn
>