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
Bill Bannon
Bill.Bannon@gmail.com
Logitrax
$875.00
2998 Johnson St.
969-7389
logitrax@gmail.com
12/26/2024
12/29/2024
Cairo
CS
43532-359
1
John Smith
John.Smith@gmail.com
Flash Delivery
$826.00
4211 White St.
657-5283
flash@gmail.com
6/17/2017
6/21/2017
York
CS
49216-521
2
Bill Johnson
Bill.Johnson@gmail.com
Speedy Express
$3,757.00
1411 Richards St.
749-6904
speedy@gmail.com
6/4/2023
6/7/2023
Sidney
RN
60055-936
3
Bill Johnson
Bill.Johnson@gmail.com
Flash Delivery
$3,726.00
5830 Smith St.
386-9225
flash@gmail.com
12/29/2021
12/31/2021
Rome
SP
68314-900
4
Sue Peters
Sue.Peters@gmail.com
Flash Delivery
$4,181.00
7805 Peters St.
536-8839
flash@gmail.com
4/2/2025
4/4/2025
Sidney
SC
30389-799
5
Brad Bannon
Brad.Bannon@gmail.com
Speedy Express
$1,816.00
733 Adams St.
474-3094
speedy@gmail.com
8/3/2023
8/5/2023
Florence
RN
49435-787
6
Brad Johnson
Brad.Johnson@gmail.com
Flash Delivery
$2,873.00
3667 Adams St.
171-6401
flash@gmail.com
6/30/2023
7/4/2023
York
CS
84785-789
7
Brad Adams
Brad.Adams@gmail.com
Logitrax
$670.00
8232 Brown St.
383-5911
logitrax@gmail.com
12/7/2019
12/11/2019
Hamburg
RN
45292-803
8
Tony Brown
Tony.Brown@gmail.com
Flash Delivery
$4,655.00
8170 Johnson St.
543-2252
flash@gmail.com
10/13/2024
10/17/2024
Rome
RT
10958-820
9
Mark Smith
Mark.Smith@gmail.com
Flash Delivery
$4,819.00
3576 Brown St.
135-3263
flash@gmail.com
2/5/2021
2/8/2021
Sidney
RT
12121-419
10
Brad Bannon
Brad.Bannon@gmail.com
Speedy Express
$435.00
1431 Smith St.
675-1084
speedy@gmail.com
11/21/2022
11/23/2022
York
CS
45470-132
11
Brad Wong
Brad.Wong@gmail.com
Flash Delivery
$2,565.00
677 Richards St.
565-5972
flash@gmail.com
1/19/2020
1/22/2020
Florence
RS
13334-489
12
Aaron Wong
Aaron.Wong@gmail.com
Flash Delivery
$3,636.00
5308 Brown St.
332-2607
flash@gmail.com
8/14/2019
8/17/2019
Cairo
RN
82617-591
13
Brad Johnson
Brad.Johnson@gmail.com
Flash Delivery
$1,880.00
3667 Adams St.
171-6401
flash@gmail.com
4/11/2022
4/15/2022
York
CS
84785-789
14
Paul White
Paul.White@gmail.com
Flash Delivery
$382.00
3916 Smith St.
186-8372
flash@gmail.com
12/15/2019
12/17/2019
Cairo
SP
84671-275
15
Tony Wong
Tony.Wong@gmail.com
Logitrax
$3,670.00
7199 Peters St.
487-8711
logitrax@gmail.com
7/23/2024
7/25/2024
Cairo
RS
32963-654
16
Brad Wong
Brad.Wong@gmail.com
Logitrax
$4,259.00
677 Richards St.
565-5972
logitrax@gmail.com
3/25/2020
3/27/2020
Florence
RS
13334-489
17
Joe White
Joe.White@gmail.com
Logitrax
$3,922.00
2876 Brown St.
680-3736
logitrax@gmail.com
10/18/2018
10/22/2018
Rome
RT
93725-107
18
Brad Smith
Brad.Smith@gmail.com
Speedy Express
$609.00
4792 Johnson St.
362-2390
speedy@gmail.com
5/5/2017
5/6/2017
Hamburg
RN
90837-302
19
Frank Smith
Frank.Smith@gmail.com
Speedy Express
$289.00
5769 Brown St.
298-7114
speedy@gmail.com
5/6/2021
5/7/2021
Paris
RT
42177-961
20
Joe Bannon
Joe.Bannon@gmail.com
Logitrax
$3,000.00
3020 Adams St.
784-4184
logitrax@gmail.com
8/10/2020
8/11/2020
Cairo
RS
17670-616
21
Joe White
Joe.White@gmail.com
Speedy Express
$2,228.00
4501 Bannon St.
864-2894
speedy@gmail.com
4/20/2025
4/22/2025
Sidney
SC
78355-890
22
Chris Johnson
Chris.Johnson@gmail.com
Logitrax
$1,838.00
5206 Wong St.
979-4717
logitrax@gmail.com
11/28/2023
12/2/2023
Cairo
CS
74872-547
23
Tom Wong
Tom.Wong@gmail.com
Flash Delivery
$3,566.00
1694 Wong St.
574-5354
flash@gmail.com
1/29/2022
2/1/2022
Florence
CS
94517-172
24
Frank Brown
Frank.Brown@gmail.com
Flash Delivery
$1,513.00
9000 White St.
744-8956
flash@gmail.com
7/29/2020
7/30/2020
Cairo
SP
61381-230
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. } |