GridViewSettings.SettingsFilterControl Property
Provides access to the filter control’s settings.
Namespace: DevExpress.Web.Mvc
Assembly: DevExpress.Web.Mvc5.v24.1.dll
NuGet Package: DevExpress.Web.Mvc5
Declaration
Property Value
Type | Description |
---|---|
ASPxGridViewFilterControlSettings | An ASPxGridViewFilterControlSettings object that contains the filter control settings. |
Remarks
@Html.DevExpress().GridView(settings => {
settings.Name = "gridView";
settings.CallbackRouteValues = new { Controller = "Filtering", Action = "FilterBuilderPartial" };
settings.Settings.ShowFilterBar = GridViewStatusBarMode.Visible;
settings.Width = Unit.Percentage(100);
settings.Columns.Add("ProductName", MVCxGridViewColumnType.TextBox);
settings.Columns.Add("Category.CategoryName", MVCxGridViewColumnType.TextBox);
settings.Columns.Add("Supplier.CompanyName", MVCxGridViewColumnType.TextBox);
settings.Columns.Add("Supplier.ContactName", MVCxGridViewColumnType.TextBox);
settings.Columns.Add("UnitPrice", MVCxGridViewColumnType.SpinEdit).PropertiesEdit.DisplayFormatString = "c";
settings.Columns.Add("UnitsInStock", MVCxGridViewColumnType.SpinEdit);
settings.SettingsFilterControl.ViewMode = FilterControlViewMode.VisualAndText;
settings.SettingsFilterControl.AllowHierarchicalColumns = FilterBuilderOptions.AllowHierarchicalColumns;
settings.SettingsFilterControl.ShowAllDataSourceColumns = FilterBuilderOptions.ShowAllDataSourceColumns;
settings.SettingsFilterControl.MaxHierarchyDepth = 1;
settings.ClientSideEvents.BeginCallback = "onBeginCallback";
settings.FilterControlColumnsCreated = (sender, e) => {
foreach(string col in columnsToRemove)
e.Columns.Remove(col);
};
settings.PreRender = (sender, e) => {
MVCxGridView gridView = sender as MVCxGridView;
if (gridView != null)
gridView.FilterExpression = "Category.CategoryName = 'Beverages'";
};
DevExpress.Web.Demos.GridViewFeaturesHelper.SetupGlobalGridViewBehavior(settings);
}).Bind(Model).GetHtml()
See Also