Features

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 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;
}

<h4>@Html.Raw(Resources.MultiRowExplorer.DisableServerRead_Text2)</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>@Html.Raw(Resources.MultiRowExplorer.DisableServerRead_Text3)</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>@Html.Raw(Resources.MultiRowExplorer.DisableServerRead_Text0)</p>

<p>@Html.Raw(Resources.MultiRowExplorer.DisableServerRead_Text1)</p>

}