or
<script id="incompleteTrainTemplate" type="text/kendo-tmpl"> @(Html.Kendo().Grid<CNX.Domain.Entities.CnxRailcar>() .Name("IncompleteTrains_#=Id#") .Editable(editable => editable.Mode(GridEditMode.InCell)) .Columns(columns => { columns.Bound(o => o.Id).Visible(false); columns.Bound(o => o.TRAIN_GUID).Visible(false); columns.Bound(o => o.EQUIPMENT_NUMBER).Width(125); columns.Bound(o => o.SEQUENCE_NUMBER).Width(75) ; columns.Bound(o => o.PILE).Width(75); columns.Bound(o => o.CLASS).Width(75); columns.Bound(o => o.LOT).Width(75); columns.Bound(o => o.INBOUND_TRACK).EditorTemplateName("_inboundTrackDropDown").Width(100); columns.Bound(o => o.EMPTY_TRACK).EditorTemplateName("_emptyTrackDropDown").Width(100); columns.Bound(o => o.AS_RECEIVED_WEIGHT).Width(100); columns.Bound(o => o.STATUS); }) .DataSource(dataSource => dataSource.Ajax() .PageSize(10) .Update(update => update.Action("CnxRailcarUpdate" , "MenuTrain" , Model)) .Read(read => read.Action("CnxRailcars", "MenuTrain", new { trainGuid = "#=Id#" }) .Type(HttpVerbs.Post)) .Update(update => update.Action("CnxRailcarUpdate", "MenuTrain", Model).Type(HttpVerbs.Post)) .Model(model => model.Id(o => o.Id))) .Pageable() .Sortable() .Filterable() .Events(ev => ev.Save("incompleteRailcars_Save"))//.DataBound("function(e){setTimeout(function(){$('\\#Lot_#=Id#').data('kendoDropDownList').dataSource.read()})}")) .ToolBar(tb => { tb.Template(() => { @Html.Kendo().DropDownList().Name("Lot_#=Id#").DataTextField("val").DataValueField("id").DataSource(dataSource => dataSource.Read(read => read.Action("GetTrainLots", "MenuTrain", new { trainGuid = "#=TRAIN_GUID#" }))); }); }) .ToClientTemplate() ) </script>[HttpPost] public ActionResult CnxRailcars(Guid trainGuid, [DataSourceRequest] DataSourceRequest request) { return Json(cnxRailcarRepository.Railcars(trainGuid).ToDataSourceResult(request)); }[HttpPost] public JsonResult GetTrainLots(Guid trainGuid, [DataSourceRequest] DataSourceRequest request) { return Json(cnxRailcarRepository.Railcars(trainGuid).ToDataSourceResult(request)); }.Events(ev => ev.Save("incompleteRailcars_Save")).DataBound("function(e){setTimeout(function(){$('\\#Lot_#=Id#').data('kendoDropDownList').dataSource.read()})}"))@model IEnumerable<MVCCOD.ViewModels.ProviderDisputeViewModel>@(Html.Kendo().Grid(Model).Name("Disputes").Columns(c => { c.Bound(p => p.ID); c.Bound(p => p.BillingPrvName); /* etc */ } ). DataSource(d => d .Ajax() .Read(r => r.Action("JsonRead", "ProviderDispute")).PageSize(50) ).Pageable(). Sortable()) public class ProviderDisputeController : Controller { public ActionResult Index() { return View(GetDisputes()); } public ActionResult JsonRead([DataSourceRequest] DataSourceRequest request) { return Json(GetDisputes().ToDataSourceResult(request)); } private List<ProviderDisputeViewModel> GetDisputes() {/* etc */}}
01.@model IEnumerable<Backend.ViewModel.ViewSalon>02.<div id="salonDetail">03. 04. @(Html.Kendo().Grid(Model)05. .Name("Grid")06. .Columns(c =>07. {08. c.Bound(m => m.Id).Width(30);09. c.Bound(m => m.Name).Width(110).HtmlAttributes(new { @class = "customerName" });10. c.Bound(m => m.Telephone).Width(100);11. c.Bound(m => m.ContactPerson).Width(100);12. c.Bound(m => m.City).Width(50);13. c.Bound(m => m.StatusId).HtmlAttributes(new { @class = "statusid" }).Hidden();14. c.Bound(m => m.Kundnr).Width(50);15. 16. }) 17. .Scrollable()18. .DataSource(dataSource => dataSource 19. .Ajax() 20. .ServerOperation(false) 21. )22. 23. .ColumnMenu()24. .Reorderable(reorder => reorder.Columns(true))25. .Resizable(resize => resize.Columns(true)) 26. .Selectable(selectable => selectable.Mode(GridSelectionMode.Multiple))27. .Sortable()28. .Filterable()29. .Events(events => events.Change("onChange").DataBound("onDataBound").DataBinding("onDataBinding"))30. .HtmlAttributes(new { style = "height: 408px" })31. )32.</div>01.@* Loads cookie support *@02.<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.2/jquery.cookie.js"></script> 03. 04.<script type="text/javascript">05. //START: *** Save grid state ***06. 07. function onDataBound(e) {08. var grid = $(this).data("kendoGrid");09. var dataSource = this.dataSource;10. 11. var state = kendo.stringify({12. page: dataSource.page(),13. pageSize: dataSource.pageSize(),14. sort: dataSource.sort(),15. group: dataSource.group(),16. filter: dataSource.filter()17. });18. 19. $.cookie("customerState", state);20. 21. if ($.cookie('customerRows')) {22. $.each(JSON.parse($.cookie('customerRows')), function () {23. var item = dataSource.get(this);24. var row = grid.tbody.find('[data-uid=' + item.uid + ']');25. row.addClass('k-state-selected');26. });27. }28. }29. 30. function onChange(e) {31. var grid = $(this).data("kendoGrid");32. var ids = grid.select().map(function () {33. return grid.dataItem($(this)).Id;34. }).toArray();35. $.cookie('customerRows', JSON.stringify(ids));36. }37. 38. function parseFilterDates(filter, fields) {39. if (filter.filters) {40. for (var i = 0; i < filter.filters.length; i++) {41. parseFilterDates(filter.filters[i], fields);42. }43. }44. else {45. if (fields[filter.field].type == "date") {46. filter.value = kendo.parseDate(filter.value);47. }48. }49. }50. 51. function onDataBinding() {52. 53. }54. 55. $(document).ready(function () {56. var grid = $('#Grid').data("kendoGrid");57. 58. var state = JSON.parse($.cookie("customerState"));59. if (state) {60. if (state.filter) {61. parseFilterDates(state.filter, grid.dataSource.options.schema.model.fields);62. }63. grid.dataSource.query(state);64. }65. else {66. grid.dataSource.read();67. }68. 69. // END: *** Save grid state ***70.</script>
<link href="@Url.Content("~/Content/kendo/2013.2.918/kendo.dataviz.min.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Content/kendo/2013.2.918/kendo.metro.min.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Content/kendo/2013.2.918/kendo.dataviz.metro.min.css")" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="@Url.Content("~/Scripts/kendo/2013.2.918/jquery.min.js")"></script>
<script type="text/javascript" src="@Url.Content("~/Scripts/kendo/2013.2.918/kendo.all.min.js")"></script>
<script type="text/javascript" src="@Url.Content("~/Scripts/kendo/2013.2.918/kendo.aspnetmvc.min.js")"></script>
<div> @(Html.Kendo().ComboBox() .Name("countires") .Filter("contains") .HtmlAttributes(new { style = "width:250px" }) .Placeholder("please select") .DataTextField("Text") .DataValueField("Value") .DataSource(source => source.Read(read => { read.Url("http://localhost:59590/api/Search/GetCountires"); }).ServerFiltering(true)) .HighlightFirst(true) .IgnoreCase(true) .AutoBind(false) .Suggest(true) ) </div>[HttpGet] public List<MVC.SelectListItem> GetCountires(string text) { text = string.IsNullOrEmpty(text) ? null : text.ToUpper(); DataTable results = Counties.GetALLCountires(text); return ConvertToSelectListItem(results); }@Html.Kendo().MultiSelectFor(model => model.Programs).BindTo((SelectList)ViewBag.Programs).DataTextField("Text").DataValueField("Id").Name("SelectedProgramIds ")Models.Program[] obj = model.List();ViewBag.Programs = new SelectList(obj, "Id", "Name", project.Programs);public IEnumerable<String> SelectedProgramIds { get; set; }@(Html.Kendo().Grid<Pattern>().Name("Pattern").ToolBar(toolbar => { toolbar.Create().Text("New Pattern"); } ) .DataSource(dataSource => dataSource.Ajax().PageSize(50) .Model(model => { model.Id(s => s.RegExID); model.Field(s => s.Category).DefaultValue(new Category()); model.Field(s => s.Table).DefaultValue(new ExpressionTable()); model.Field(s => s.Version).DefaultValue("%"); } ) .Create(create => create.Action("CreatePattern", "Pattern")) .Destroy(destroy => destroy.Action("DeletePattern", "Pattern")) .Update(update => update.Action("UpdatePattern", "Pattern")) .Read(reader => reader.Action("LoadPattern", "Pattern")) ) .Sortable() .Selectable() .Pageable(pager => { pager.Enabled(true).Refresh(true).PageSizes(new int[] { 50, 100, 150 }); pager.Info(false); }) .Scrollable(s => s.Enabled(true).Height(500)) .Filterable(filterable => filterable.Extra(false).Operators(operators => operators .ForString(str => str.Clear() .StartsWith("Starts with") .Contains("Contains") ) ) ) .Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("PatternPopUp")))<div class="editor-label"> @Html.LabelFor(model => model.Table)</div><div class="editor-field"> @(Html.Kendo().DropDownListFor(model => model.Table) .OptionLabel("Please select a value") .HtmlAttributes(new { style = "width: 200px" }) .AutoBind(true) .Name("Table") .DataTextField("Name") .DataValueField("TableID") .Events(e => { e.Select("select"); e.DataBound("bound"); } ) .DataSource(source => { source.Read(read => { read.Action("GetRegExpressions", "Pattern"); }) .ServerFiltering(true); }) )</div><div id="regSW"> <div class="editor-label"> @Html.LabelFor(model => model.SoftwareName) </div> <div class="editor-field"> @Html.EditorFor(model => model.SoftwareName) @Html.ValidationMessageFor(model => model.SoftwareName) </div> <div class="editor-label"> @Html.LabelFor(model => model.SoftwarePublisher) </div> <div class="editor-field"> @Html.EditorFor(model => model.SoftwarePublisher) @Html.ValidationMessageFor(model => model.SoftwarePublisher) </div> <div class="editor-label"> @Html.LabelFor(model => model.Version) </div> <div class="editor-field"> @Html.EditorFor(model => model.Version) @Html.ValidationMessageFor(model => model.Version) </div></div><div id="regMachine"> <div class="editor-label"> @Html.LabelFor(model => model.InstallSource) </div> <div class="editor-field"> @Html.EditorFor(model => model.InstallSource) @Html.ValidationMessageFor(model => model.InstallSource) </div></div><div class="editor-label"> @Html.LabelFor(model => model.Category)</div><div class="editor-field"> @(Html.Kendo().DropDownListFor(model => model.Category) .OptionLabel("Please select a value") .HtmlAttributes(new { style = "width: 200px" }) .AutoBind(false) .Name("Category") .DataTextField("Name") .DataValueField("CategoryID") .DataSource(source => { source.Read(read => { read.Action("GetCategories", "Software"); }) .ServerFiltering(true); }) )</div><div class="editor-label" id="regDeslbl"> @Html.LabelFor(model => model.Description)</div><div class="editor-field" id="regDesfld"> @Html.TextAreaFor(model => model.Description, new { @class = "k-textbox", style = "width: 200px" }) @Html.ValidationMessageFor(model => model.Description)</div><script> $("#regSW").hide(); $("#regMachine").hide();</script>