CollectionView
CollectionView
Overview
This view shows basic features of CollectionView ASP.NET MVC.
Features
ID
Start
End
Country
Product
Color
Amount
Amount2
Discount
Active
ID
Start
End
Country
Product
Color
Amount
Amount2
Discount
Active
1
Jan 25 25
00:00
Japan
Gadget
Green
($1,375.59)
$4,973.59
8%
2
Feb 25 25
01:30
France
Gadget
Black
($675.56)
$1,595.47
23%
3
Mar 25 25
02:00
France
Gadget
White
($1,973.65)
$3,545.64
23%
4
Apr 25 25
03:30
Canada
Widget
Red
($1,569.50)
$542.50
8%
5
May 25 25
04:00
China
Widget
Black
$1,936.18
$4,318.75
16%
6
Jun 25 25
05:30
Korea
Widget
Black
($4,051.31)
$4,551.07
17%
7
Jul 25 25
06:00
Japan
Widget
White
$490.49
$616.38
2%
8
Aug 25 25
07:30
UK
Gadget
Green
($2,603.68)
$4,325.14
6%
9
Sep 25 25
08:00
Italy
Widget
Green
$1,157.55
$689.19
25%
10
Oct 25 25
09:30
France
Widget
Red
($1,422.21)
$4,862.28
0%
11
Nov 25 25
10:00
UK
Widget
Red
$4,583.94
$428.34
22%
12
Dec 25 25
11:30
Canada
Widget
Black
($664.57)
$267.81
3%
13
Jan 25 25
12:00
German
Widget
White
($4,633.05)
$2,740.22
12%
14
Feb 25 25
13:30
German
Widget
White
$4,963.03
$2,624.30
5%
15
Mar 25 25
14:00
Canada
Widget
White
($1,327.75)
$1,387.59
12%
16
Apr 25 25
15:30
France
Gadget
Red
$4,824.71
$1,433.36
8%
17
May 25 25
16:00
Italy
Gadget
Green
$2,349.56
$509.09
0%
18
Jun 25 25
17:30
China
Widget
Red
($1,502.40)
$1,235.17
18%
19
Jul 25 25
18:00
Canada
Widget
Green
$1,503.62
$826.77
5%
20
Aug 25 25
19:30
Korea
Widget
White
$827.91
$4,942.48
11%
21
Sep 25 25
20:00
Japan
Widget
Black
$1,062.11
$2,951.82
18%
22
Oct 25 25
21:30
German
Widget
Red
($2,157.27)
$1,881.78
10%
23
Nov 25 25
22:00
UK
Widget
Black
($3,673.38)
$2,603.91
9%
24
Dec 25 25
23:30
UK
Widget
Green
$2,037.47
$3,192.72
4%
25
Jan 25 25
00:00
UK
Widget
Red
($2,250.57)
$2,904.08
4%
26
Feb 25 25
01:30
Japan
Widget
Red
$4,100.38
$989.70
13%
0
Settings
Description
This view shows basic features of CollectionView ASP.NET MVC.
The RefreshOnEdit property determines whether the CollectionView should automatically refresh its results (by applying the sort, filter, and grouping operations) after items are edited. This property is set to true by default, which ensures the collection is always sorted, filtered, and grouped correctly after any edit operations.
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 | using MvcExplorer.Models; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace MvcExplorer.Controllers { public partial class CollectionViewController : Controller { private readonly ControlOptions _optionsModel = new ControlOptions { Options = new OptionDictionary { { "Refresh On Edit" , new OptionItem {Values = new List< string > { "True" , "False" }, CurrentValue = "True" }} } }; public ActionResult Index(FormCollection data) { _optionsModel.LoadPostData(data); ViewBag.DemoOptions = _optionsModel; var model = Sale.GetData(500); return View(model); } } } |
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 | @using C1.Web.Mvc.Grid @model IEnumerable< Sale > @ { ControlOptions optionsModel = ViewBag.DemoOptions; ViewBag.DemoSettings = true ; } @ (Html.C1().CollectionViewService() .Id( "CVService" ) .Bind(Model) .RefreshOnEdit(Convert.ToBoolean(optionsModel.Options[ "Refresh On Edit" ].CurrentValue)) .DisableServerRead( true ) ) @ (Html.C1().FlexGrid< Sale >() .Id( "FlexGridCV" ) .ItemsSourceId( "CVService" ) .AutoGenerateColumns( false ) .Columns(bl => { bl.Add(cb => cb.Binding( "ID" )); bl.Add(cb => cb.Binding( "Start" ).Format( "MMM d yy" )); bl.Add(cb => cb.Binding( "End" ).Format( "HH:mm" )); bl.Add(cb => cb.Binding( "Country" )); bl.Add(cb => cb.Binding( "Product" )); bl.Add(cb => cb.Binding( "Color" )); bl.Add(cb => cb.Binding( "Amount" ).Format( "c" )); bl.Add(cb => cb.Binding( "Amount2" ).Format( "c" )); bl.Add(cb => cb.Binding( "Discount" ).Format( "p0" )); bl.Add(cb => cb.Binding( "Active" )); }) .SortingType(AllowSorting.SingleColumn) .CssClass( "grid" ) .Height(500) ) @section Summary{ < p > @Html .Raw(Resources.CollectionView.Index_Text0)</ p > } @section Settings{ @Html .Partial( "_OptionsMenu" , optionsModel) } @section Description{ < p > @Html .Raw(Resources.CollectionView.Index_Text0)</ p > < p > @Html .Raw(Resources.CollectionView.Index_Text1)</ p > } |