This question is locked. New answers and comments are not allowed.
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);
}
}
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);
}
}
