I have an OpenAccessLinqDataSource that pulls from some FK linked tables. The FK value is nullable (UInt32?) and while sorting works, I'm having some difficulties filtering.
Here's my LinqDataSource
The Promo_topic.SpotID is the column I'm trying to filter on using the following:
but I get 0 results returned when I filter on a valid Promo_topic.SpotID
I tried custom filtering:
with the following ItemCommand event:
Before I switch the entire DataLinqSource to reference a custom object, is there something I'm doing wrong?
Thanks.
Here's my LinqDataSource
<
telerik:OpenAccessLinqDataSource
ID
=
"OA_Promos"
Runat
=
"server"
ContextTypeName
=
"Flow.ST2_Data"
EntityTypeName
=
""
OrderBy
=
"ID desc"
ResourceSetName
=
"Promos"
Select
=
"new (ID, identifier, descriptor, lastUpdated, notes, startDate, endDate, startTime, endTime, priority, Promo_art.Art, Promo_art.width, Promo_art.height, Promo_art.fileName, Promo_topic.SpotID)"
Where
=
"Deleted == @Deleted"
>
<
WhereParameters
>
<
asp:Parameter
DefaultValue
=
"0"
Name
=
"Deleted"
Type
=
"Int16"
/>
</
WhereParameters
>
</
telerik:OpenAccessLinqDataSource
>
The Promo_topic.SpotID is the column I'm trying to filter on using the following:
<
telerik:GridBoundColumn
DataField
=
"Promo_topic.SpotID"
AllowFiltering
=
"true"
SortExpression
=
"SpotID"
CurrentFilterFunction
=
"EqualTo"
FilterControlAltText
=
"Filter SpotID Column"
AutoPostBackOnFilter
=
"true"
ShowFilterIcon
=
"False"
UniqueName
=
"SpotID"
HeaderText
=
"Spot ID"
DataType
=
"System.UInt32"
></
telerik:GridBoundColumn
>
but I get 0 results returned when I filter on a valid Promo_topic.SpotID
I tried custom filtering:
<
telerik:GridBoundColumn
DataField
=
"Promo_topic.SpotID"
AllowFiltering
=
"true"
SortExpression
=
"SpotID"
CurrentFilterFunction
=
"Custom"
FilterControlAltText
=
"Filter SpotID Column"
AutoPostBackOnFilter
=
"true"
ShowFilterIcon
=
"False"
UniqueName
=
"SpotID"
HeaderText
=
"Spot ID"
DataType
=
"System.UInt32"
></
telerik:GridBoundColumn
>
with the following ItemCommand event:
protected
void
ItemCommandFired(
object
sender, GridCommandEventArgs e)
{
if
(e.CommandName == RadGrid.FilterCommandName)
{
Pair filterPair = (Pair)e.CommandArgument;
if
(filterPair.First.ToString() ==
"Custom"
)
{
string
colName = filterPair.Second.ToString();
TextBox tbPattern = (e.Item
as
GridFilteringItem)[colName].Controls[0]
as
TextBox;
e.Canceled =
true
;
grid_promos.MasterTableView.FilterExpression =
string
.Format(
"(Promo_topic.SpotID.Equals({0})) AND (Promo_topic.SpotID != null)"
, tbPattern.Text);
grid_promos.Rebind();
}
}
}
but then get the error "Methods on type 'UInt32?' are not accessible"
Before I switch the entire DataLinqSource to reference a custom object, is there something I'm doing wrong?
Thanks.