What is the best approach to load/filter/order a Kendo grid with the following classes:
Domain:
public class Car
{
public virtual in
I followed the suggestion of CodingWithSpike and it works. I created an extension method for the DataSourceRequest class:
public static class DataSourceRequestExtensions
{
///
/// Finds a Filter Member with the "memberName" name and renames it for "newMemberName".
///
/// The DataSourceRequest instance.
/// The Name of the Filter to be renamed.
/// The New Name of the Filter.
public static void RenameRequestFilterMember(this DataSourceRequest request, string memberName, string newMemberName)
{
foreach (var filter in request.Filters)
{
var descriptor = filter as Kendo.Mvc.FilterDescriptor;
if (descriptor.Member.Equals(memberName))
{
descriptor.Member = newMemberName;
}
}
}
}
Then in your controller, add the using
to the extension class and before the call to ToDataSourceResult(), add this:
request.RenameRequestFilterMember("IsActiveText", "IsActive");