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
Disable Server Reading
Disable Server Reading
Features
MultiRow without paging
Paging MultiRow which PageSize is set to 10
Settings
Description
This sample shows how to disable server-side reading in MultiRow control.
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 and the operations like sorting, paging, and filtering will be done in the client side. Hence, "Loading..." text is not shown while loading the data when the scrollbar scrolls. Otherwise, sorting, paging or filtering will be done at the server side. And sometimes "Loading..." text will be shown.
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)); }); }; } } } }
using MultiRowExplorer.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 MultiRowExplorer.Controllers { public partial class MultiRowController : 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) { _disableServerReadSetting.LoadPostData(collection); ViewBag.DemoOptions = _disableServerReadSetting; return View(Sale.GetData(500)); } } }
@model IEnumerable<Sale> @{ ControlOptions optionsModel = ViewBag.DemoOptions; ViewBag.DemoSettings = true; } @section Styles{ <style> label { display: inline-block; font-weight: normal; padding: 3px; } </style> } <h4>MultiRow without paging</h4> @(Html.C1().MultiRow<Sale>() .Id("dsrMultiRow") .CssClass("multirow") .IsReadOnly(true) .Filterable() .Bind(b => b.DisableServerRead(Convert.ToBoolean(optionsModel.Options["Disable Server Read"].CurrentValue)).InitialItemsCount(10).Bind(Model)) .LayoutDefinition(LayoutDefinitionsBuilders.Sales) ) <br /> <br /> <h4>Paging MultiRow which PageSize is set to 10</h4> @(Html.C1().MultiRow<Sale>() .Id("dsrPagingMultiRow") .CssClass("multirow") .IsReadOnly(true) .Filterable() .Bind(b => b.DisableServerRead(Convert.ToBoolean(optionsModel.Options["Disable Server Read"].CurrentValue)).PageSize(10).Bind(Model)) .LayoutDefinition(LayoutDefinitionsBuilders.Sales) ) @(Html.C1().Pager().Owner("dsrPagingMultiRow")) @section Settings{ @Html.Partial("_OptionsMenu", optionsModel) } @section Description{ <p> This sample shows how to disable server-side reading in MultiRow control. </p><p> This sample shows what the <b>DisableServerRead</b> property works for. When it is set to True, all the items will be transferred to the client side and the operations like sorting, paging, and filtering will be done in the client side. Hence, "Loading..." text is not shown while loading the data when the scrollbar scrolls. Otherwise, sorting, paging or filtering will be done at the server side. And sometimes "Loading..." text will be shown. </p> }