This is a migrated thread and some comments may be shown as answers.

[Solved] Custom filter and data context

1 Answer 114 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Alessandro
Top achievements
Rank 1
Alessandro asked on 05 Jan 2011, 12:09 PM
Hello,
In my project I have a custom datacontext in binding with the Gridview.
I've followed your sample:

http://blogs.telerik.com/blogs/posts/10-01-14/how_to_server_sorting_filtering_grouping_and_paging_with_radgridview_for_silverlight_without_wcf_ria_services.aspx

All works fine and I can sorting, filtering and paging server side.
Now I need to create custom filters. I have created custom controls that implement the IFilteringControl interface. In my filters the user can set the value and the operator, so in the OnFilter sub, I need to set the value and the operator of my FilterDescriptor.
This is a sample of my OnFilter sub:

Private textFilter As FilterDescriptor
  
Private Sub OnFilter(ByVal sender As Object, ByVal e As RoutedEventArgs)
    Me.textFilter.Value = Me.searchText.Text
    ' Test operator
    Me.textFilter.Operator = FilterOperator.Contains
    ...
    ...
    ...
    ...
    Me.IsActive = True
End Sub

In this situation I have a problem: as soon as I set the FilterDescriptor value, my collection is automatically updated and my system call the WCF function that reload the data. The problem is that the FilterDescriptor operator will be set after the refresh of the collection and so the filter is not corrected.
I would like to "control" the refresh of my datacontext and perform the refresh only after the activation of the filter (the last line of the code).

Sorry if I don't have a sample project, but it's not simple to extract all my logic in this situation.
Thanks,
Alessandro

1 Answer, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 07 Jan 2011, 10:11 AM
Hello Alessandro,

 Possible solution will be to not add this FilterDescriptor to the collection since the grid will react immediately on any property change. You can add it when all properties are set. 

Regards,
Vlad
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
Tags
GridView
Asked by
Alessandro
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Share this question
or