or
@(Html.Kendo().Grid<Umki2.Areas.Wlb.ViewModels.VmWlbWeldLogBook>() .Name("grid") .Columns(columns => { columns.Bound(c => c.JointNo).Width(140); columns.Bound(c => c.WlbJointLocation).Width(190); columns.Command(command => command.Custom("FitUp").Click("showDetails")); }) .HtmlAttributes(new { style = "height: 380px;" }) .Scrollable() .Groupable() .Sortable() .Pageable(pageable => pageable .Refresh(true) .PageSizes(true) .ButtonCount(5)) .DataSource(dataSource => dataSource .Ajax() .Read(read => read.Action("Grid_Read", "WlbExplorer")) ))@(Html.Kendo().Window().Name("Details") .Title("Customer Details") .Visible(false) .Modal(true) .Draggable(true) .Width(300))<script type="text/x-kendo-template" id="template"> <div id="details-container"> <h2>#= JointNo # #= JointNo #</h2> <em>#= WlbJointLocation #</em> <dl> <dt>City: #= WlbJointLocation #</dt> <dt>Address: #= WlbJointLocation #</dt> </dl> </div></script><script type="text/javascript"> var detailsTemplate = kendo.template($("#template").html()); function showDetails(e) { e.preventDefault(); var dataItem = this.dataItem($(e.currentTarget).closest("tr")); var wnd = $("#Details").data("kendoWindow"); wnd.content(detailsTemplate(dataItem)); wnd.center().open(); }</script>@(Html.Kendo().TreeView() .Name("fao") .HtmlAttributes(new {@class="fixed-height" }) .DataTextField("Text") .TemplateId("treeview-item-template") .DataSource(ds => ds .Read(r => r .Action("_ModuleData", "Home") ) .Model(m => m .Children("Items") .HasChildren("HasChildren") ) ))<script id="treeview-item-template" type="text/kendo-ui-template"> #= item.Text #<input type='hidden' class='hidden-data' data-fal='#= item.Fal#' data-uid='#=item.uid#'/></script>function doSomething(e){ for(n=0; n<e.node.nodes.length; n++) { doSomethingElse(e.node.nodes[n]); }}@model IEnumerable<Umki2.Areas.Wlb.ViewModels.VmWlbWeldLogBook>
@(Html.Kendo().Grid(Model) .Name("grid") .DataSource(ds => ds .Ajax() .PageSize(20) .Model(model => { model.Id(a => a.Id); model.Field(a => a.Id).Editable(false); model.Field(a => a.PID).Editable(false); }) .Create(create => create.Action("Grid_Create", "WlbWeldLogBook")) .Read(read => read.Action("Grid_Read", "WlbWeldLogBook")) .Update(update => update.Action("Grid_Update", "WlbWeldLogBook")) .Destroy(destroy => destroy.Action("Grid_Destroy", "WlbWeldLogBook")) ) .Columns(p => { p.Command(commands => { commands.Edit(); commands.Destroy(); }).Title("").Width(180).Locked(); p.Bound(c => c.WlbLine).Width(160); p.ForeignKey(c => c.WlbSpoolId, (System.Collections.IEnumerable)ViewData["WlbSpoolId"], "Id", "SpoolNo").Width(110).Locked(true).Lockable(false); p.Bound(c => c.PID).Width(200); p.Bound(c => c.JointNo).Width(110).Locked(true).Lockable(false); p.Bound(c => c.WeldingProcess).Width(200); p.Bound(c => c.WlbJointLocation).Width(200); p.Bound(c => c.WlbJointType).Width(200); p.ForeignKey(c => c.WrhIdentity1Id, (System.Collections.IEnumerable)ViewData["WrhIdentityList"], "Id", "IdentityNo").Width(110); p.ForeignKey(c => c.WrhIdentity2Id, (System.Collections.IEnumerable)ViewData["WrhIdentityList"], "Id", "IdentityNo").Width(110); }) .ToolBar(toolbar => { toolbar.Create(); toolbar.Excel(); }) .Editable(editable => editable.Mode(GridEditMode.InLine)) .Pageable() .Sortable() .Groupable() .Filterable(ftb => ftb.Mode(GridFilterMode.Menu)) .Resizable(resizable => resizable.Columns(true)) .Scrollable(scrollable => scrollable.Height(430)) .Reorderable(reorderable => reorderable.Columns(true)) .ColumnMenu() .Excel(excel => excel .FileName("LineList_" + System.DateTime.Now + ".xlsx") .Filterable(true) .ProxyURL(Url.Action("Excel_Export_Save", "Grid")) ) )@model Umki2.Areas.Wlb.Models.WlbLine@(Html.Kendo().DropDownListFor(m => m) .AutoBind(false) .OptionLabel("Select Line...") .DataTextField("LineNo") .DataValueField("Id") .DataSource(dataSource => { dataSource.Read(read => read.Action("GetLines", "WlbWeldLogBook", new { area = "Wlb" })) .ServerFiltering(true); }))@Html.ValidationMessageFor(m => m)public JsonResult GetLines() { return Json( db.WlbLine.Select(x => new { Id = x.Id, LineNo = x.LineNo }), JsonRequestBehavior.AllowGet); } public ActionResult Index() { ViewBag.WlbSpoolId = db.WlbSpool.ToList(); ViewBag.WrhIdentityList = db.WrhIdentityList.ToList(); return View(); } public ActionResult Grid_Read([DataSourceRequest]DataSourceRequest request) { IQueryable<WlbJoint> WlbJoint = db.WlbJoint; var model = from o in db.WlbJoint select new VmWlbWeldLogBook { Id = o.Id, JointNo = o.JointNo, WeldingProcess = o.WeldingProcess, WlbJointType = o.WlbJointType, WlbJointLocation = o.WlbJointLocation, WlbSpoolId = o.WlbSpoolId, WrhIdentity1Id = o.WrhIdentity1Id, WrhIdentity2Id = o.WrhIdentity2Id, WlbLineId = o.WlbSpool.WlbIsometric.WlbLineId, PID = o.WlbSpool.WlbIsometric.WlbLine.PID }; DataSourceResult result = model.ToDataSourceResult(request); return Json(result); }@(Html.Kendo().LinearGauge() .Name("progressGauge") .Pointer(pointer => pointer .Value(2.5) .Shape(GaugeLinearPointerShape.Arrow) ) .Scale(scale => scale .MajorUnit(1) .MinorUnit(0.5) .Max(4) .Vertical(false) .Ranges(ranges => { ranges.Add().From(0).To(1).Color("#dbe5f1"); ranges.Add().From(1).To(2).Color("#cadbf0"); ranges.Add().From(2).To(3).Color("#b2c9e5"); ranges.Add().From(3).To(4).Color("#94b6df"); }) ) ).Labels(x=>x .Template("#= 't' #")).Labels(x=>x .Template("# 'function(r){ return 't'} #"))Uncaught Error: Invalid template:'# 'function(r){ return 't'} #' Generated code:'var $kendoOutput, $kendoHtmlEncode = kendo.htmlEncode;with(data){$kendoOutput=''; 'function(r){ return 't'} ;$kendoOutput+='';}return $kendoOutput;'.Labels(x=>x .Template("#= 'function(r){ return 't'} #"))Uncaught Error: Invalid template:'#= 'function(r){ return 't'} #' Generated code:'var $kendoOutput, $kendoHtmlEncode = kendo.htmlEncode;with(data){$kendoOutput=''+( 'function(r){ return 't'} )+'';}return $kendoOutput;'@model int@(Html.Kendo().ComboBox() .Name("ContactID") .HtmlAttributes(new { style = "width:300px" }) .AutoBind(false) .Placeholder("Escriu...") .DataTextField("Nom") .DataValueField("ContactID") .Filter(FilterType.Contains) .MinLength(4) .DataSource(source => { source.Read(read => read.Action("SearchProductors", "Productors", new { area = "Comercial" }).Data("filterProductors")) .ServerFiltering(true); }) //.HeaderTemplateId("ProductorSearch_HeaderTemplate") .TemplateId("ProductorSearch_ItemTemplate"))<script id="ProductorSearch_HeaderTemplate" type="text/x-kendo-tmpl"> <div> <span class="k-widget k-header">Productor</span> <span class="k-widget k-header">Poblacio</span> </div></script><script id="ProductorSearch_ItemTemplate" type="text/x-kendo-tmpl"> <div style="width:300px"> @*<span class="k-state-default">#: data.Poblacio #</span>*@ <p><span class="k-state-default">#: data.Nom #</span><span class="k-state-default">#: data.Poblacio #</span></p> </div> </script>public class CollectServiceViewModel { [DisplayName("Ordre")] [HiddenInput(DisplayValue = false)] [Required(ErrorMessage = "El número d'ordre es obligatori.")] public int ServiceID { get; set; } [DisplayName("Albarà")] public string RefExt { get; set; } [DisplayName("Full Seguiment")] public string DocNum { get; set; } [DisplayName("Data Comanda")] //[DisplayFormat(DataFormatString = "{0:d}")] [DataType(DataType.Date)] public DateTime DataOrdre { get; set; } [DisplayName("Data Servei")] [DataType(DataType.Date)] [UIHint("CustomDate")] public Nullable<DateTime> DataServei { get; set; } [DisplayName("Expedició")] [UIHint("ExpeditionsByData")] public Nullable<int> ExpeditionID { get; set; } //public Nullable<short> Position { get; set; } [DisplayName("Urgent")] public bool Urgent { get; set; } [DisplayName("Reclamat")] [DataType(DataType.Date)] public Nullable<DateTime> DataClaim { get; set; } [DisplayName("Recollida Extra")] public bool Extra { get; set; } [DisplayName("Productor")] [Required(ErrorMessage = "El productor es obligatori.")] [UIHint("ProductorSearch")] public int ContactID { get; set; } [DisplayName("Productor")] [HiddenInput(DisplayValue = false)] public string ProductorName { get; set; }@(Html.Kendo().Grid<CollectServiceViewModel>() .Name("collects") .HtmlAttributes(new { style = "height: 100%; border: 0;" }) .Scrollable() .ToolBar(t => { if (User.IsInRole("Modify")) { t.Create().Text("Nou Servei"); } }) .Columns(columns => { columns.Bound(f => f.ServiceID).Width(80); columns.Bound(f => f.DataServei).Width(110); columns.Bound(f => f.RefExt).Width(110); columns.Bound(f => f.DocNum).Width(110); columns.Bound(f => f.ProductorName).Width(300).Filterable(f => f.Operators(g => g.ForString(h => { h.Clear(); h.Contains("Conté"); }))); columns.Bound(f => f.ContactID).Title("Codi").Width(80);@(Html.Kendo().MobileView() .Title("Site Verification") .Name("outage-details-view") .Content(@<text> @using (Ajax.BeginForm("OutageDetails", "Outage", new AjaxOptions { HttpMethod = "POST" })) { @Html.ValidationSummary(true); @Html.AntiForgeryToken() <div class="form-group"> @Html.LabelFor(model => model.MeterNumber) @Html.TextBoxFor(model => model.MeterNumber, new { @type = "number", @class = "form-control", placeholder = "Meter Number" }) </div> <div class="form-group"> <label>OR</label> </div> <div class="form-group"> @Html.LabelFor(model => model.SiteId) @Html.TextBoxFor(model => model.SiteId, new { @class = "form-control", @type = "number", placeholder = "Site ID" }) </div> <input type="submit" value="Next"/> } </text>))@{ Html.Kendo().Grid<Vectra.CPN.CPNLibrary.ViewModel.TRANSFER_IN_V>() .Name("MainGrid") .ToolBar(toolBar => toolBar.Template(@<text> <input class="t-button" type="button" id="ShowCreateNewExtFormId" name="ShowCreateNewExtForm" value="@Resources.Create" onclick="location.assign('@Url.Content("~/" + ControllerName + "/New")')"/> <input class="t-button" type="button" id="ShowEditFormId" name="ShowEditForm" value="@Resources.Edit" /> <input class="t-button" type="button" id="ShowDetailFormId" name="ShowDetailForm" value="@Resources.Details" /> <a class="k-button k-button-icontext k-grid-excel" href="#"><span class="k-icon k-i-excel"></span>Zapisz do Excela</a> <a href="" class="k-button" id="save">Save View</a> <a href="" class="k-button" id="load">Restore View</a> </text>) ) .Excel(ex => ex.AllPages(true).FileName("cpn_do_vectry_" + DateTime.Now.ToShortDateString() + ".xlsx")) .ColumnMenu(column => column.Columns(true)) .Columns(columns => columns.LoadSettings((IEnumerable<GridColumnSettings>)ViewBag.GridColumns)) .Reorderable(reorder => reorder.Columns(true)) .Sortable(sortable => sortable.Enabled(true).SortMode(GridSortMode.SingleColumn).AllowUnsort(true)) .Pageable(pageable => pageable.Enabled(true).Refresh(true).ButtonCount(5).PageSizes(true).PageSizes(new int[] { 5, 10, 20, 50 })) .Filterable(filtering => filtering.Enabled(true)) .Selectable(s => s.Mode(Kendo.Mvc.UI.GridSelectionMode.Single).Type(GridSelectionType.Row)) .Events(events => events.Change("onChange")) .DataSource(dataSource => dataSource .Ajax() .Read(read => read.Action("TransferIn_Read", "TransferIn")) .Model(model => model.Id(o => o.TRANSFER_ID)) .ServerOperation(false) ) .AutoBind(false) .Render() ;}var localStorageKey = "MainTransferInOptions";var areOptionsLoaded = false;function bindSaveRestoreCliks(){ var grid = $("#MainGrid").data("kendoGrid"); $("#save").click(function (e) { e.preventDefault(); localStorage[localStorageKey] = kendo.stringify(grid.getOptions()); }); $("#load").click(function (e) { e.preventDefault(); loadGridOptions(e); });}function loadGridOptions(e){ if (e == undefined || e.type == "click" || (!areOptionsLoaded && e.type == "read")) { var rawGrid = $("#MainGrid"); var grid = $("#MainGrid").data("kendoGrid"); var options = localStorage[localStorageKey]; var toolbar = $("#MainGrid").find(".k-grid-toolbar").html(); if (options) { grid.setOptions(JSON.parse(options)); } else if (!areOptionsLoaded && e == undefined) { grid.dataSource.read(); } var newtoolbar = $("#MainGrid").find(".k-grid-toolbar"); $("#MainGrid").find(".k-grid-toolbar").html(toolbar); bindSaveRestoreCliks(); areOptionsLoaded = true; } }$(window).ready(function (e) { loadGridOptions(undefined);});