using System.Collections.Generic;
using System.Web.Mvc;
using WebApiExplorer.Models;
namespace WebApiExplorer.Controllers
{
public partial class MVCFlexGridController : Controller
{
private readonly GridExportImportOptions _flexGridPagingModel = new GridExportImportOptions
{
NeedExport = true,
NeedImport = false,
OnlyCurrentPage = false,
IncludeColumnHeaders = true
};
private readonly ControlOptions _gridPagingModel = new ControlOptions
{
Options = new OptionDictionary
{
{"Page Size", new OptionItem {Values = new List<string> {"10", "25", "50", "100"}, CurrentValue = "25"}},
}
};
public ActionResult Paging(FormCollection data)
{
ViewBag.Options = _flexGridPagingModel;
_gridPagingModel.LoadPostData(data);
ViewBag.DemoOptions = _gridPagingModel;
return View(Sale.GetData(500));
}
}
}
@using WebApiExplorer.Models
@model IEnumerable<Sale>
@{
GridExportImportOptions exportOptionsModel = ViewBag.Options;
ControlOptions optionsModel = ViewBag.DemoOptions;
ViewBag.DemoSettings = true;
}
@(Html.C1().FlexGrid<Sale>().Id(exportOptionsModel.ControlId).Height(300)
.Bind(Model)
.IsReadOnly(true)
.PageSize(Convert.ToInt32(optionsModel.Options["PageSize"].CurrentValue))
)
@(Html.C1().Pager().Owner(exportOptionsModel.ControlId))
@section Settings{
@Html.Partial("_OptionsMenu", optionsModel)
@Html.Partial("_FlexGridOptions", exportOptionsModel)
}
@section Description{
<p>@Html.Raw(Resources.MVCFlexGrid.Paging_Text0)</p>
}