I'm trying to figure out if what I'm attempting is impossible or if I'm just not coding it correctly. I am trying to do a server side filtering on a telerik combo box so that even if the data isn't loaded into the combo box(only showing 100 records) the server will still filter based on what is typed in combo box. The filtering that the control comes with is for client side only so I thought this would get by that. Any help would be great. The column I'm trying to filter on is last_name(a string in code, varchar in sql server) from the domain data source.
Here is the error I get from my domaindatasource LoadedData method
System.InvalidOperationException: The FilterDescriptor with its PropertyPath equal to 'last_name' cannot be evaluated. ---> System.ArgumentException: Operator 'StartsWith' incompatible with operand types 'String' and 'Object' --->
System.InvalidOperationException: The type String does not expose a method called 'StartsWith' at
System.Windows.Controls.LinqHelper.GetMethod(String methodName, Expression left, Expression right)
as System.Windows.Controls.LinqHElper.GenerateMethodCall(String methodName, Expression left, Expression right)
at System.Windows.Controls.LinqHelper.GenerateStartsWith(Expression left, Expression right)
at System.Windows.Controls.LinqHelper.BuildFilterExpression(Expression propertyExpression, FilterOperator filterOperator, Expression valueExpression, Boolean isCaseSensitive)
at System.Windows.Controls.LinqHelper.BuildFilterExpression(Type type, String propertyPath, FIlterOperator filterOperator, Object value, Boolean isCaseSensitive, Expression& filterExpression) -- end of inner exception stack trace
I've tried contains and I get the same thing. What am I doing wrong? Thanks.
Here is the code being used for this part:
Here is the error I get from my domaindatasource LoadedData method
System.InvalidOperationException: The FilterDescriptor with its PropertyPath equal to 'last_name' cannot be evaluated. ---> System.ArgumentException: Operator 'StartsWith' incompatible with operand types 'String' and 'Object' --->
System.InvalidOperationException: The type String does not expose a method called 'StartsWith' at
System.Windows.Controls.LinqHelper.GetMethod(String methodName, Expression left, Expression right)
as System.Windows.Controls.LinqHElper.GenerateMethodCall(String methodName, Expression left, Expression right)
at System.Windows.Controls.LinqHelper.GenerateStartsWith(Expression left, Expression right)
at System.Windows.Controls.LinqHelper.BuildFilterExpression(Expression propertyExpression, FilterOperator filterOperator, Expression valueExpression, Boolean isCaseSensitive)
at System.Windows.Controls.LinqHelper.BuildFilterExpression(Type type, String propertyPath, FIlterOperator filterOperator, Object value, Boolean isCaseSensitive, Expression& filterExpression) -- end of inner exception stack trace
I've tried contains and I get the same thing. What am I doing wrong? Thanks.
Here is the code being used for this part:
<riaControls:DomainDataSource.FilterDescriptors> |
<riaControls:FilterDescriptor IsCaseSensitive="False" PropertyPath="last_name" |
Value="{Binding Path=Text,ElementName=cmbParticipant}" Operator="StartsWith" > |
</riaControls:FilterDescriptor> |
</riaControls:DomainDataSource.FilterDescriptors> |
and here is the combo box
<UserControl.Resources> |
<DataTemplate x:Key="cmbParticipantItemTemplate"> |
<StackPanel Orientation="Horizontal"> |
<TextBlock Text="{Binding participant_id}"/> |
<TextBlock Text=" - "/> |
<TextBlock Text="{Binding last_name}" /> |
<TextBlock Text=", "/> |
<TextBlock Text="{Binding first_name}"/> |
</StackPanel> |
</DataTemplate> |
</UserControl.Resources> |
<telerikInput:RadComboBox x:Name="cmbParticipant" HorizontalAlignment="Left" Grid.Row="7" |
Grid.Column="1" Width="238" IsEditable="True" |
IsDropDownOpen="False" MaxDropDownHeight="200" StaysOpenOnEdit="True" |
IsFilteringEnabled="True" |
OpenDropDownOnFocus="True" |
ItemsSource="{Binding Data, ElementName=dsParticipants}" |
VerticalAlignment="Top" |
TextSearchMode="StartsWith" |
telerik:TextSearch.TextPath="last_name" |
ItemTemplate="{StaticResource cmbParticipantItemTemplate}"/> |
I've tried without using an item template as well and just displaying the last_name.