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

[Solved] Grid Server Side Filtering

1 Answer 115 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.
Rajaram
Top achievements
Rank 1
Rajaram asked on 11 Jun 2009, 10:10 AM
I see that unlike sorting, gridview does not support server side filtering by default.

I need to implement a paginating grid and hence all row filtering, sorting should be on the server.

I was toying with getting this done by hooking onto the property changed events of the filterdiscription and then making server side calls.

I feel this is kind of a hack and may have other unanticipated problems.
Is there a better way or is this a good enough workaround that wont cause problems?


Code:
//first attach to propertychanged event
 var filterDescription = ((CompositeFilterDescription) RadGridView1.FilterDescription).FilterDescriptions;
                foreach (var description in filterDescription)
                {
                    description.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(description_PropertyChanged);
                }

//
Then in propertychanged make a server side call
        void description_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            var filterDescriptions = ((CompositeFilterDescription)RadGridView1.FilterDescription).FilterDescriptions;
           
            RadGridView1.ItemsSource = new MyBusinessObjects().GetData();

            //Was crashing if i dint do this, clearing and reseting the filters after the data is rebound
            ((CompositeFilterDescription)RadGridView1.FilterDescription).FilterDescriptions.Clear();
            foreach (var description in filterDescriptions)
            {
                ((CompositeFilterDescription)RadGridView1.FilterDescription).FilterDescriptions.Add(description);
            }
        }



1 Answer, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 11 Jun 2009, 02:53 PM
Hi Rajaram,

In Silverlight 3 you can use DomainDataSource and the grid will transfer automatically sorting and grouping however for filtering you can handle Filtering/Filtered events and add desired FilterDescriptors directly in DomainDataSource based on grid FilterDescriptors.

For more info about DomainDataSource support you can check my blog post:
http://blogs.telerik.com/vladimirenchev/posts/09-04-16/full_support_for_domaindatasource_with_radgridview_for_silverlight_3.aspx

Regards,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
GridView
Asked by
Rajaram
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Share this question
or