or
<%=ViewHelper.CreateGridFromType<OverviewTopFiveModel>(this) .Name("DailyTopFive") .DataBinding(dataBinding => dataBinding.Ajax() .Select("AjaxDailyTopFive", "Home")) .Filterable() .Sortable() .ScrollBars(false)%>public static GridBuilder<TModel> CreateGridFromType<TModel>(ViewPage page) where TModel : class { // create the custom grid var component = (page.ViewContext.HttpContext.Items[StyleSheetRegistrar.Key] as StyleSheetRegistrar) ?? new StyleSheetRegistrar(new WebAssetCollection(WebAssetDefaultSettings.StyleSheetFilesPath), page.ViewContext, DI.Current.Resolve<IWebAssetCollectionResolver>()); var scriptWrapper = DI.Current.Resolve<ScriptWrapperBase>(); var registrar2 = (page.ViewContext.HttpContext.Items[ScriptRegistrar.Key] as ScriptRegistrar) ?? new ScriptRegistrar(new WebAssetCollection(WebAssetDefaultSettings.ScriptFilesPath), new List<IScriptableComponent>(), page.ViewContext, DI.Current.Resolve<IWebAssetCollectionResolver>(), scriptWrapper); var test = new CustomViewComponentFactory(page.Html, DI.Current.Resolve<IClientSideObjectWriterFactory>(), ComponentBuilderBase<StyleSheetRegistrar, StyleSheetRegistrarBuilder>.Create(component), ComponentBuilderBase<ScriptRegistrar, ScriptRegistrarBuilder>.Create(registrar2)); var cGrid = test.Grid<TModel>(); var grid = new GridBuilder<TModel>(cGrid); // create the columns grid.Columns(CreateGridColumnsFromType(grid)); // hook internal events grid.ClientEvents(e => e.OnLoad("onInternalGridLoad")); grid.ClientEvents(e => e.OnDataBinding("onInternalGridDataBinding")); grid.ClientEvents(e => e.OnDataBound("onInternalGridDataBound")); grid.ClientEvents(e => e.OnDetailViewExpand("onInternalGridDetailViewExpand")); grid.ClientEvents(e => e.OnDetailViewCollapse("onInternalGridDetailViewCollapse")); grid.ClientEvents(e => e.OnRowDataBound("onInternalRowDataBound")); grid.ClientEvents(e => e.OnCommand("onInternalGridCommand")); return grid; }TimeZoneCollection timeZones = new TimeZoneCollection(this.AppSettings); timeZones.Load(); List<TimeZoneListModel> models = Mapper.Map<TimeZoneCollection, List<TimeZoneListModel>>(timeZones); IQueryable<TimeZoneListModel> dataSource = models.AsQueryable(); return Json(dataSource.ToDataSourceResult(request));
@(Html.Kendo().Grid<Shmiffer.Web.Areas.Admin.Models.TimeZoneListModel>() .Name("grdTimeZones") .Groupable(grouping => grouping .Enabled(true)) .DataSource(dataSource => dataSource .Ajax() .Read(read => read.Action("Index", "TimeZones")) .Sort(sort => sort.Add(tz => tz.TimeZoneId).Ascending()) .PageSize(10) .Group(group => group.Add(tz => tz.SupportsDaylightSavingTime))) .Filterable(filtering => filtering .Enabled(true)) .Pageable(paging => paging .Enabled(true) .Info(true) .PageSizes(false) .Refresh(true)) .Scrollable(scrolling => scrolling .Enabled(false) .Height(200) .Virtual(true)) .Sortable(sorting => sorting .Enabled(true) .AllowUnsort(false) .SortMode(GridSortMode.SingleColumn)) )

@model NS.Quoting.Models.ViewModels.QuoteLineGridViewModel@(Html.Kendo().Grid(Model.QuoteLines) .Name("QuotesGrid") .Columns(columns => { columns.Bound(c => c.LineNumber).Filterable(false).Width(60).Title("Line #"); columns.Bound(c => c.ItemNumber).Title("Material #"); columns.Bound(c => c.ItemDescription).Title("Material Name"); columns.Bound(c => c.Quantity).Filterable(false).Width(70).Title("Quantity"); columns.Bound(c => c.SalePrice).Filterable(false).Width(81).Title("Quoted Price"); columns.Bound(c => c.LinePrice).Filterable(false).Width(60).Title("Extended Price"); columns.Bound(c => c.MarginPercent).Filterable(false).Width(60).Title("Margin %"); }) .ClientRowTemplate( "<tr>" + "<td class='line'>" + "<span class='linenumber'> #: LineNumber # </span>" + "</td>" + "<td class='materialNum'>" + "<span class='itemnumber'> #: ItemNumber # </span>" + "</td>" + "<td class='materialName'>" + "<span class='itemdescription'> #: ItemDescription # </span>" + "</td>" + "<td class='QTY'>" + "<span class='quantity'> #: Quantity # </span>" + "</td>" + "<td class='quotedPrice'>" + "<span class='saleprice'> #: SalePrice # </span>" + "</td>" + "<td class='extendedPrice'>" + "<span class='lineprice'> #: LinePrice # </span>" + "</td>" + "<td class='marginPerc'>" + "<span class='marginpercent'> #: MarginPercent # </span>" + "</td>" + "</tr>" ) .DataSource(dataSource => dataSource .Ajax().ServerOperation(false) ) .Pageable(pager => pager.PageSizes(new int[]{10,25,50})) .Scrollable() .Sortable() .Filterable())<div id="itemGrids"> <h3>Active Items</h3> <div id="newAct"> @Html.Action("GetGrid", "Quote", new { id = Model.Quote.QuoteNumber, isActive = true }) </div> <h3>Inctive Items</h3> <div id="newDe"> @Html.Action("GetGrid", "Quote", new { id = Model.Quote.QuoteNumber, isActive = false }) </div> </div>public IEnumerable<QuoteLineSummary> QuoteLines { get; set; }public PartialViewResult GetGrid(int id, bool isActive){ QuoteLineGridViewModel model = new QuoteLineGridViewModel(); using (var client = new HttpClient()) { // URL: /api/QuoteLine/GetByQuoteNumber/1 var lineUrl = Url.RouteUrl( "ActionApi", new { httproute = "", controller = "QuoteLine", action = "GetSummaryByQuoteNumber", id = id, isActive = isActive }, Request.Url.Scheme ); model.QuoteLines = client .GetAsync(lineUrl) .Result .Content.ReadAsAsync<IEnumerable<QuoteLineSummary>>().Result; } return PartialView("_QuoteLineGrid", model);}