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
Tom Smith
Tom.Smith@gmail.com
Flash Delivery
$2,724.00
1939 White St.
837-9250
flash@gmail.com
10/28/2022
11/1/2022
York
RS
52456-591
1
Brad Richards
Brad.Richards@gmail.com
Flash Delivery
$256.00
4684 Brown St.
174-1064
flash@gmail.com
3/6/2024
3/10/2024
Hamburg
SP
98598-507
2
Tony White
Tony.White@gmail.com
Speedy Express
$2,917.00
3728 Richards St.
172-2886
speedy@gmail.com
11/16/2024
11/20/2024
Hamburg
RN
34862-490
3
Tom Johnson
Tom.Johnson@gmail.com
Flash Delivery
$2,967.00
6664 Richards St.
479-2800
flash@gmail.com
6/20/2020
6/22/2020
Hamburg
RT
56798-611
4
Paul Peters
Paul.Peters@gmail.com
Flash Delivery
$4,396.00
2807 Bannon St.
584-9745
flash@gmail.com
8/27/2017
8/28/2017
Rome
RS
53332-810
5
Paul White
Paul.White@gmail.com
Speedy Express
$4,418.00
3333 Adams St.
835-2400
speedy@gmail.com
7/23/2020
7/24/2020
Paris
RT
91828-733
6
Tom Smith
Tom.Smith@gmail.com
Speedy Express
$807.00
9941 Smith St.
755-8600
speedy@gmail.com
8/27/2017
8/28/2017
Sidney
RT
73484-850
7
Aaron Peters
Aaron.Peters@gmail.com
Logitrax
$2,857.00
5976 Richards St.
352-9463
logitrax@gmail.com
4/4/2021
4/8/2021
York
RN
31619-723
8
Bill Wong
Bill.Wong@gmail.com
Speedy Express
$2,400.00
8605 Bannon St.
334-3820
speedy@gmail.com
12/12/2017
12/13/2017
Hamburg
RS
40453-891
9
Brad Wong
Brad.Wong@gmail.com
Logitrax
$550.00
2182 Wong St.
575-7558
logitrax@gmail.com
12/16/2019
12/20/2019
Sidney
SP
12442-171
10
Brad Richards
Brad.Richards@gmail.com
Flash Delivery
$1,873.00
4684 Brown St.
174-1064
flash@gmail.com
4/22/2022
4/25/2022
Hamburg
SP
98598-507
11
Mark Smith
Mark.Smith@gmail.com
Logitrax
$1,330.00
1358 Brown St.
301-4399
logitrax@gmail.com
3/13/2023
3/14/2023
Sidney
RT
64780-203
12
Tony White
Tony.White@gmail.com
Flash Delivery
$2,738.00
3728 Richards St.
172-2886
flash@gmail.com
9/23/2024
9/24/2024
Hamburg
RN
34862-490
13
Tom Johnson
Tom.Johnson@gmail.com
Logitrax
$2,856.00
6664 Richards St.
479-2800
logitrax@gmail.com
4/15/2018
4/19/2018
Hamburg
RT
56798-611
14
John Smith
John.Smith@gmail.com
Logitrax
$3,862.00
552 Brown St.
790-9586
logitrax@gmail.com
5/4/2019
5/7/2019
Hamburg
SC
50459-742
15
Mark Smith
Mark.Smith@gmail.com
Logitrax
$2,085.00
4644 Richards St.
915-6229
logitrax@gmail.com
1/14/2019
1/17/2019
Paris
RS
56260-743
16
John Brown
John.Brown@gmail.com
Logitrax
$1,130.00
3458 White St.
161-6531
logitrax@gmail.com
10/10/2019
10/14/2019
York
SP
69575-588
17
Brad Wong
Brad.Wong@gmail.com
Speedy Express
$2,187.00
2182 Wong St.
575-7558
speedy@gmail.com
9/29/2023
10/3/2023
Sidney
SP
12442-171
18
Chris White
Chris.White@gmail.com
Logitrax
$1,722.00
173 Bannon St.
283-8038
logitrax@gmail.com
2/1/2022
2/4/2022
Sidney
RT
49456-885
19
Chris White
Chris.White@gmail.com
Flash Delivery
$4,148.00
173 Bannon St.
283-8038
flash@gmail.com
1/11/2018
1/14/2018
Sidney
RT
49456-885
20
Sue Brown
Sue.Brown@gmail.com
Speedy Express
$3,619.00
5428 Brown St.
502-1394
speedy@gmail.com
7/16/2018
7/18/2018
Rome
RN
75370-660
21
Tom Smith
Tom.Smith@gmail.com
Flash Delivery
$4,132.00
9941 Smith St.
755-8600
flash@gmail.com
11/15/2019
11/19/2019
Sidney
RT
73484-850
22
Frank Peters
Frank.Peters@gmail.com
Speedy Express
$907.00
4162 Johnson St.
794-4373
speedy@gmail.com
9/13/2019
9/16/2019
Rome
RN
53862-956
23
Chris White
Chris.White@gmail.com
Flash Delivery
$4,683.00
173 Bannon St.
283-8038
flash@gmail.com
7/5/2024
7/9/2024
Sidney
RT
49456-885
24
Tom Johnson
Tom.Johnson@gmail.com
Flash Delivery
$4,515.00
6664 Richards St.
479-2800
flash@gmail.com
2/27/2025
3/1/2025
Hamburg
RT
56798-611
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. } |