FlexGrid
Disable Server Reading
This sample shows what the DisableServerRead property works for.
Features
FlexGrid without paging
ID
Start
End
Country
Product
Color
Amount
Amount2
Discount
Active
Url
1
1/25/2025
1/25/2025
Japan
Gadget
Green
-1,375.59
4,973.59
0.08
https://en.wikipedia.org/wiki/Tourism_in_Japan
2
2/25/2025
2/25/2025
France
Gadget
Black
-675.56
1,595.47
0.23
https://en.wikipedia.org/wiki/Tourism_in_France
ID
Start
End
Country
Product
Color
Amount
Amount2
Discount
Active
Url
0
Paging FlexGrid which PageSize is set to 10
ID
Start
End
Country
Product
Color
Amount
Amount2
Discount
Active
Url
1
1/25/2025
1/25/2025
Canada
Widget
Green
-3,815.01
2,066.79
0.22
https://en.wikipedia.org/wiki/Tourism_in_Canada
2
2/25/2025
2/25/2025
Italy
Widget
Green
-4,954.73
3,723.38
0.23
https://en.wikipedia.org/wiki/Tourism_in_Italy
3
3/25/2025
3/25/2025
Korea
Gadget
Red
-798
3,030.78
0.12
https://en.wikipedia.org/wiki/Tourism_in_Korea
4
4/25/2025
4/25/2025
Japan
Gadget
Red
-225.89
445.05
0.02
https://en.wikipedia.org/wiki/Tourism_in_Japan
5
5/25/2025
5/25/2025
Japan
Gadget
Black
4,900.88
3,073.69
0.06
https://en.wikipedia.org/wiki/Tourism_in_Japan
6
6/25/2025
6/25/2025
Japan
Gadget
Green
-1,772.80
744.65
0.21
https://en.wikipedia.org/wiki/Tourism_in_Japan
7
7/25/2025
7/25/2025
China
Widget
Black
-3,597.22
4,341.92
0.05
https://en.wikipedia.org/wiki/Tourism_in_China
8
8/25/2025
8/25/2025
France
Gadget
Green
4,615.66
2,231.02
0.20
https://en.wikipedia.org/wiki/Tourism_in_France
9
9/25/2025
9/25/2025
Korea
Gadget
White
4,789.04
437.37
0.23
https://en.wikipedia.org/wiki/Tourism_in_Korea
10
10/25/2025
10/25/2025
Canada
Gadget
Black
1,913.54
2,287.67
0.23
https://en.wikipedia.org/wiki/Tourism_in_Canada
ID
Start
End
Country
Product
Color
Amount
Amount2
Discount
Active
Url
0
Settings
Description
This sample shows what the DisableServerRead property works for.
When it is set to True, all the items will be transferred to the client side. Sorting, paging or filtering will be done in the client side.
And the text like "Loading..." is not shown for loading the data when the scrollbar scrolls.
Otherwise, sorting, paging or filtering will be done in server side. And sometimes the "Loading..." text will be shown.
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 | using MvcExplorer.Models; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using C1.Web.Mvc; using System.Collections; using System.Globalization; namespace MvcExplorer.Controllers { public partial class FlexGridController : Controller { private readonly ControlOptions _disableServerReadSetting = new ControlOptions { Options = new OptionDictionary { { "Disable Server Read" , new OptionItem{Values = new List< string > { "True" , "False" },CurrentValue = "True" }} } }; public ActionResult DisableServerRead(FormCollection collection) { IValueProvider data = collection; if (CallbackManager.CurrentIsCallback) { var request = CallbackManager.GetCurrentCallbackData<CollectionViewRequest< object >>(); if (request != null && request.ExtraRequestData != null ) { var extraData = request.ExtraRequestData.Cast<DictionaryEntry>() .ToDictionary(kvp => ( string )kvp.Key, kvp => kvp.Value.ToString()); data = new DictionaryValueProvider< string >(extraData, CultureInfo.CurrentCulture); } } _disableServerReadSetting.LoadPostData(data); ViewBag.DemoOptions = _disableServerReadSetting; return View(Sale.GetData(500)); } } } |
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 | @model IEnumerable< Sale > @ { ControlOptions optionsModel = ViewBag.DemoOptions; ViewBag.DemoSettings = true ; } < h4 > @Html .Raw(Resources.FlexGrid.DisableServerRead_Text1)</ h4 > @ (Html.C1().FlexGrid< Sale >() .AutoGenerateColumns( true ) .Id( "dsrFlexGrid" ) .CssClass( "grid" ) .IsReadOnly( true ) .Filterable() .Bind(b => b.DisableServerRead(Convert.ToBoolean(optionsModel.Options[ "Disable Server Read" ].CurrentValue)).InitialItemsCount(10).Bind(Model)) ) < br /> < br /> < h4 > @Html .Raw(Resources.FlexGrid.DisableServerRead_Text2)</ h4 > @ (Html.C1().FlexGrid< Sale >() .AutoGenerateColumns( true ) .CssStyle( "height" , "auto" ) .Id( "dsrPagingGrid" ) .CssClass( "grid" ) .IsReadOnly( true ) .Filterable() .Height(300) .Bind(b => b.DisableServerRead(Convert.ToBoolean(optionsModel.Options[ "Disable Server Read" ].CurrentValue)).PageSize(10).Bind(Model)) ) @ (Html.C1().Pager().Owner( "dsrPagingGrid" )) @section Settings{ @Html .Partial( "_OptionsMenu" , optionsModel) } @section Description{ @Html .Raw(Resources.FlexGrid.DisableServerRead_Text0) } |