Features
- Overview
- Collapsible Column Headers
- Styling Records, Groups, and Cells
- Grouping
- Filtering
- Row and Column Freezing
- Paging
- Group Panel
- Remote Data Binding
- Custom Cells
- Custom Editors
- Editing
- Batch Editing
- Sorting
- Virtual Scrolling
- Disable Server Reading
- Data Map
- Excel Export
- PDF Export
- Unobtrusive Validation
Filtering
Filtering
This sample shows how to use filtering in the MultiRow control.
Features
Id
ShippedDate
Customer.Name
Customer.Email
Customer.Phone
Shipper.Name
0
Sue Brown
Sue.Brown@gmail.com
Speedy Express
$3,132.00
7746 White St.
922-4345
speedy@gmail.com
2/4/2020
2/5/2020
Cairo
SP
50425-164
1
Chris Johnson
Chris.Johnson@gmail.com
Logitrax
$2,742.00
5944 Johnson St.
524-9161
logitrax@gmail.com
2/18/2024
2/19/2024
Hamburg
RS
44652-947
2
Mark Smith
Mark.Smith@gmail.com
Speedy Express
$4,958.00
8456 Smith St.
747-7892
speedy@gmail.com
5/6/2018
5/10/2018
Sidney
RS
34736-160
3
Tony Wong
Tony.Wong@gmail.com
Flash Delivery
$1,046.00
6027 Smith St.
974-2665
flash@gmail.com
10/18/2024
10/19/2024
Florence
CS
33095-807
4
Joe Wong
Joe.Wong@gmail.com
Speedy Express
$3,963.00
9734 Peters St.
712-2558
speedy@gmail.com
6/5/2018
6/8/2018
Rome
RT
42148-343
5
Mark White
Mark.White@gmail.com
Speedy Express
$2,311.00
6261 Peters St.
299-3009
speedy@gmail.com
7/7/2023
7/8/2023
Cairo
RN
63367-194
6
John Johnson
John.Johnson@gmail.com
Flash Delivery
$763.00
3794 Smith St.
717-7905
flash@gmail.com
5/23/2017
5/24/2017
Hamburg
RN
35936-632
7
Paul Smith
Paul.Smith@gmail.com
Speedy Express
$1,129.00
3340 Johnson St.
475-4431
speedy@gmail.com
2/15/2022
2/19/2022
Florence
RS
35594-133
8
John Richards
John.Richards@gmail.com
Speedy Express
$2,410.00
6462 White St.
928-6671
speedy@gmail.com
6/4/2019
6/8/2019
Cairo
RN
49639-703
9
Mark White
Mark.White@gmail.com
Flash Delivery
$1,608.00
6261 Peters St.
299-3009
flash@gmail.com
2/8/2018
2/9/2018
Cairo
RN
63367-194
10
John Johnson
John.Johnson@gmail.com
Logitrax
$2,655.00
2942 Adams St.
623-3103
logitrax@gmail.com
2/26/2022
2/27/2022
Sidney
CS
69924-510
11
Tony Bannon
Tony.Bannon@gmail.com
Logitrax
$3,167.00
2309 Bannon St.
886-1819
logitrax@gmail.com
9/2/2024
9/4/2024
Hamburg
RN
58250-789
12
Chris Johnson
Chris.Johnson@gmail.com
Logitrax
$2,865.00
5944 Johnson St.
524-9161
logitrax@gmail.com
11/29/2017
12/2/2017
Hamburg
RS
44652-947
13
John Johnson
John.Johnson@gmail.com
Logitrax
$2,723.00
2942 Adams St.
623-3103
logitrax@gmail.com
11/19/2019
11/22/2019
Sidney
CS
69924-510
14
Paul Johnson
Paul.Johnson@gmail.com
Flash Delivery
$3,252.00
9750 Richards St.
583-6555
flash@gmail.com
7/1/2023
7/5/2023
Cairo
SP
12197-591
15
Tony Bannon
Tony.Bannon@gmail.com
Speedy Express
$291.00
2309 Bannon St.
886-1819
speedy@gmail.com
2/25/2025
2/26/2025
Hamburg
RN
58250-789
16
Tony Peters
Tony.Peters@gmail.com
Flash Delivery
$2,425.00
870 Smith St.
616-2717
flash@gmail.com
12/5/2023
12/9/2023
Rome
RT
44224-965
17
John Johnson
John.Johnson@gmail.com
Flash Delivery
$2,877.00
2942 Adams St.
623-3103
flash@gmail.com
2/18/2019
2/21/2019
Sidney
CS
69924-510
18
Sue Brown
Sue.Brown@gmail.com
Speedy Express
$2,654.00
7746 White St.
922-4345
speedy@gmail.com
6/22/2025
6/23/2025
Cairo
SP
50425-164
19
Chris Johnson
Chris.Johnson@gmail.com
Flash Delivery
$3,400.00
5944 Johnson St.
524-9161
flash@gmail.com
4/24/2025
4/26/2025
Hamburg
RS
44652-947
20
Paul Smith
Paul.Smith@gmail.com
Speedy Express
$3,735.00
3615 Adams St.
479-9667
speedy@gmail.com
2/10/2024
2/13/2024
Paris
SC
98245-548
21
Joe Johnson
Joe.Johnson@gmail.com
Logitrax
$4,271.00
6768 Richards St.
645-3909
logitrax@gmail.com
5/19/2021
5/22/2021
Hamburg
RN
69825-805
22
Tom Johnson
Tom.Johnson@gmail.com
Flash Delivery
$4,672.00
1670 Richards St.
139-9418
flash@gmail.com
5/19/2025
5/21/2025
Hamburg
RN
20777-668
23
John Adams
John.Adams@gmail.com
Speedy Express
$763.00
4621 Brown St.
533-9561
speedy@gmail.com
5/22/2017
5/23/2017
Rome
RT
68204-381
24
Tony White
Tony.White@gmail.com
Logitrax
$4,914.00
8853 Adams St.
575-5899
logitrax@gmail.com
5/10/2025
5/11/2025
Florence
RS
33214-374
ID
Customer
Customer Email
Shipper
Amount
Address
Phone
Shipper Email
Ordered
Shipped
City
State
Zip
Express
Settings
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | using C1.Web.Mvc.Fluent; using C1.Web.Mvc.Grid; using C1.Web.Mvc.MultiRow; using C1.Web.Mvc.MultiRow.Fluent; using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace MultiRowExplorer.Models { public class LayoutDefinitionsBuilders { public static Action<ListItemFactory<CellGroup, CellGroupBuilder>> OneLine { get { return ld => { ld.Add().Colspan(15).Cells(cells => { cells.Add(cell => cell.Binding( "Id" ).Header( "ID" ).CssClass( "id" )) .Add(cell => cell.Binding( "Date" ).Header( "Ordered" )) .Add(cell => cell.Binding( "ShippedDate" ).Header( "Shipped" )) .Add(cell => cell.Binding( "Amount" ).Header( "Amount" ).Format( "c" ).CssClass( "amount" )) .Add(cell => cell.Binding( "Customer.Name" ).Name( "CustomerName" ).Header( "Customer" )) .Add(cell => cell.Binding( "Customer.Address" ).Name( "CustomerAddress" ).Header( "Address" )) .Add(cell => cell.Binding( "Customer.City" ).Name( "CustomerCity" ).Header( "City" ) .DataMap(dm => { dm.DisplayMemberPath( "Value" ).SelectedValuePath( "Value" ).Bind(Orders.GetCities().ToValues()); })) .Add(cell => cell.Binding( "Customer.State" ).Name( "CustomerState" ).Header( "State" )) .Add(cell => cell.Binding( "Customer.Zip" ).Name( "CustomerZip" ).Header( "Zip" )) .Add(cell => cell.Binding( "Customer.Email" ).Name( "CustomerEmail" ).Header( "Customer Email" ).CssClass( "email" )) .Add(cell => cell.Binding( "Customer.Phone" ).Name( "Customerphone" ).Header( "Customer Phone" )) .Add(cell => cell.Binding( "Shipper.Name" ).Name( "ShipperName" ).Header( "Shipper" )) .Add(cell => cell.Binding( "Shipper.Email" ).Name( "ShipperEmail" ).Header( "Shipper Email" ).CssClass( "email" )) .Add(cell => cell.Binding( "Shipper.Phone" ).Name( "ShipperPhone" ).Header( "Shipper Phone" )) .Add(cell => cell.Binding( "Shipper.Express" ).Name( "ShipperExpress" ).Header( "Express" )); }); }; } } public static Action<ListItemFactory<CellGroup, CellGroupBuilder>> TwoLines { get { return ld => { ld.Add().Header( "Order" ).Colspan(2).Cells(cells => { cells.Add(cell => cell.Binding( "Id" ).Header( "ID" ).CssClass( "id" ).Width( "150" )) .Add(cell => cell.Binding( "Date" ).Header( "Ordered" ).Width( "150" )) .Add(cell => cell.Binding( "Amount" ).Header( "Amount" ).Format( "c" ).CssClass( "amount" )) .Add(cell => cell.Binding( "ShippedDate" ).Header( "Shipped" )); }); ld.Add().Header( "Customer" ).Colspan(3).Cells(cells => { cells.Add(cell => cell.Binding( "Customer.Name" ).Name( "CustomerName" ).Header( "Customer" ).Width( "200" )) .Add(cell => cell.Binding( "Customer.Email" ).Name( "CustomerEmail" ).Header( "Customer Email" ).Colspan(2).CssClass( "email" )) .Add(cell => cell.Binding( "Customer.Address" ).Name( "CustomerAddress" ).Header( "Address" )) .Add(cell => cell.Binding( "Customer.City" ).Name( "CustomerCity" ).Header( "City" ).ShowDropDown( true ) .DataMap(dm => { dm.DisplayMemberPath( "Value" ).SelectedValuePath( "Value" ).Bind(Orders.GetCities().ToValues()); })) .Add(cell => cell.Binding( "Customer.State" ).Name( "CustomerState" ).Header( "State" )); }); ld.Add().Header( "Shipper" ).Colspan(2).Cells(cells => { cells.Add(cell => cell.Binding( "Shipper.Name" ).Name( "ShipperName" ).Header( "Shipper" ).Colspan(2)) .Add(cell => cell.Binding( "Shipper.Email" ).Name( "ShipperEmail" ).Header( "Shipper Email" ).Width( "200" ).CssClass( "email" )) .Add(cell => cell.Binding( "Shipper.Express" ).Name( "ShipperExpress" ).Header( "Express" )); }); }; } } public static Action<ListItemFactory<CellGroup, CellGroupBuilder>> ThreeLines { get { return ld => { ld.Add().Header( "Order" ).Colspan(2).Cells(cells => { cells.Add(cell => cell.Binding( "Id" ).Header( "ID" ).Colspan(2).CssClass( "id" )) .Add(cell => cell.Binding( "Amount" ).Header( "Amount" ).Format( "c" ).Colspan(2).CssClass( "amount" )) .Add(cell => cell.Binding( "Date" ).Header( "Ordered" )) .Add(cell => cell.Binding( "ShippedDate" ).Header( "Shipped" )); }); ld.Add().Header( "Customer" ).Colspan(3).Cells(cells => { cells.Add(cell => cell.Binding( "Customer.Name" ).Name( "CustomerName" ).Header( "Customer" )) .Add(cell => cell.Binding( "Customer.Email" ).Name( "CustomerEmail" ).Header( "Customer Email" ).Colspan(2).CssClass( "email" )) .Add(cell => cell.Binding( "Customer.Address" ).Name( "CustomerAddress" ).Header( "Address" ).Colspan(2)) .Add(cell => cell.Binding( "Customer.Phone" ).Name( "CustomerPhone" ).Header( "Phone" )) .Add(cell => cell.Binding( "Customer.City" ).Name( "CustomerCity" ).Header( "City" ) .DataMap(dm => { dm.DisplayMemberPath( "Value" ).SelectedValuePath( "Value" ).Bind(Orders.GetCities().ToValues()); })) .Add(cell => cell.Binding( "Customer.State" ).Name( "CustomerState" ).Header( "State" )) .Add(cell => cell.Binding( "Customer.Zip" ).Name( "CustomerZip" ).Header( "Zip" )); }); ld.Add().Header( "Shipper" ).Cells(cells => { cells.Add(cell => cell.Binding( "Shipper.Name" ).Name( "ShipperName" ).Header( "Shipper" ).Width( "*" )) .Add(cell => cell.Binding( "Shipper.Email" ).Name( "ShipperEmail" ).Header( "Shipper Email" ).CssClass( "email" )) .Add(cell => cell.Binding( "Shipper.Express" ).Name( "ShipperExpress" ).Header( "Express" )); }); }; } } public static Action<ListItemFactory<CellGroup, CellGroupBuilder>> Sales { get { return ld => { ld.Add().Cells(cells => { cells.Add(cell => cell.Binding( "ID" ).Header( "ID" )); cells.Add(cell => cell.Binding( "Active" ).Header( "Active" )); }); ld.Add().Cells(cells => { cells.Add(cell => cell.Binding( "Start" ).Header( "Start" )); cells.Add(cell => cell.Binding( "End" ).Header( "End" )); }); ld.Add().Colspan(2).Cells(cells => { cells.Add(cell => cell.Binding( "Country" ).Header( "Country" ).Colspan(2)); cells.Add(cell => cell.Binding( "Product" ).Header( "Product" )); cells.Add(cell => cell.Binding( "Color" ).Header( "Color" )); }); ld.Add().Colspan(2).Cells(cells => { cells.Add(cell => cell.Binding( "Amount" ).Header( "Amount" )); cells.Add(cell => cell.Binding( "Amount2" ).Header( "Amount2" )); cells.Add(cell => cell.Binding( "Discount" ).Header( "Discount" ).Colspan(2)); }); }; } } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | using C1.Web.Mvc; using MultiRowExplorer.Models; using System; using System.Collections.Generic; using System.Web.Mvc; using System.Linq; namespace MultiRowExplorer.Controllers { public partial class MultiRowController : Controller { private static OptionItem CreateOptionItem() { return new OptionItem { Values = new List< string > { "None" , "Condition" , "Value" , "Both" }, CurrentValue = "Both" }; } private readonly ControlOptions _filterOptions = new ControlOptions { Options = new OptionDictionary { { "CustomerState" , CreateOptionItem()}, { "CustomerCity" , CreateOptionItem()}, { "ShipperName" , CreateOptionItem()}, { "ShipperExpress" , CreateOptionItem()}, { "Amount" , CreateOptionItem()} } }; public ActionResult Filter(FormCollection data) { _filterOptions.LoadPostData(data); ViewBag.DemoOptions = _filterOptions; ViewBag.FilterTypes = GetFilterTypes(_filterOptions); return View(Orders.GetOrders()); } private Dictionary< string , FilterType> GetFilterTypes(ControlOptions controlOptions) { var filterTypes = new Dictionary< string , FilterType>(); foreach (var item in controlOptions.Options) { filterTypes.Add(item.Key, (FilterType)Enum.Parse( typeof (FilterType), item.Value.CurrentValue)); } return filterTypes; } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | @model IEnumerable< Orders.Order > @ { ControlOptions optionsModel = ViewBag.DemoOptions; Dictionary< string , FilterType> filterTypes = ViewBag.FilterTypes; ViewBag.DemoSettings = true ; ViewBag.DemoDescription = false ; } @section Styles{ < style > label { display: inline-block; font-weight: normal; padding: 3px; } </ style > } @ (Html.C1().MultiRow< Orders.Order >() .Id( "filteringMultiRow" ) .Bind(Model) .PageSize(25) .IsReadOnly( true ) .LayoutDefinition(LayoutDefinitionsBuilders.ThreeLines) .SelectionMode(SelectionMode.Row) .AllowSorting( true ) .Filterable(f => f.DefaultFilterType(FilterType.Both) .ColumnFilters(cfsb => { foreach (var item in filterTypes) { cfsb.Add(cfb => cfb.Column(item.Key).FilterType(item.Value)); } }) ) .CssClass( "multirow" ) ) @ (Html.C1().Pager().Owner( "filteringMultiRow" )) @section Settings{ @Html .Partial( "_OptionsMenu" , optionsModel) } @section Summary{ This sample shows how to use filtering in the MultiRow control. } |