or
<div class="row"> <div class="form-group col-md-6 "> @Html.LabelFor(model => model.TeamCode) @Html.EditorFor(model => model.TeamCode) @Html.ValidationMessageFor(model => model.TeamCode) </div></div><div class="row"> <div class="form-group col-md-6 "> @Html.LabelFor(model => model.TeamName) @Html.EditorFor(model => model.TeamName) @Html.ValidationMessageFor(model => model.TeamName) </div></div><div class="row"> <div class="form-group col-md-12 "> @Html.LabelFor(model => model.TeamDesc) @Html.EditorFor(model => model.TeamDesc) @Html.ValidationMessageFor(model => model.TeamDesc) </div></div><div class="row"> <div class="form-group col-md-12"> @Html.Partial("~/Areas/Teams/Views/TeamMember/_List.cshtml", this.Model.Members, null) @Html.ValidationMessageFor(model => model.Members) </div></div> <script type="text/javascript"> function buildData() { // Get the form values into simple key value array var formData = getFormObj(); var gridData = $("#teamMemberGrid").data("kendoGrid").dataSource.data(); // Prepare the model return { TeamDetailId: formData["TeamDetailId"], TeamCode: formData["TeamCode"], TeamDesc: formData["TeamDesc"], TeamName: formData["TeamName"], Members: gridData, Dto: formData["Dto"] }; } $(function () { $("form").on("submit", function (event) { event.preventDefault(); var request = buildData(); submitForm(request, this.action); }); }); </script><div> @(Html.AjaxGridFor<TeamMemberModel>("teamMemberGrid", "Teams", "TeamMember") .ToolBar ( toolbar => { if (Html.ShowEditControls()) { toolbar.Template("<a class='k-button k-button-icontext ' href='' id='customGridAdd'><span></span>New</a><span></span>"); } } ) .Columns ( columns => { if (Html.ShowEditControls()) { columns.Command(commands => { commands.Custom("Edit").Text("Edit").Click("onGridEdit"); commands.Custom("Delete").Text("Delete").Click("onGridDelete"); }); } } ) .BuildAjaxDataSource<TeamMemberModel>("TeamMember", updateAction: "UpdateMember", createAction: "AddMember", destroyAction: "RemoveMember") ) <script type="text/javascript"> function onGridEditing(e) { var id = $('#TeamDetailId').val(); if (e.model.isNew()) { e.model.set("TeamDetailId", id); e.model.set("TeamMemberId", kendo.guid()); } setPopupTitle(e); setGridPopupButtons(e); } //set username, first name, last name function onGridSaving(e) { var data = e.sender.dataSource.data(); for (var i = 0; i < data.length; i++) { var item = data[i]; if (item.TeamMemberId === e.model.TeamMemberId) { item.set('Username', $('Username').val()); } } } function onGridDelete(e) { var grid = $("#teamMemberGrid").data("kendoGrid"); var row = $(e.currentTarget).closest("tr"); grid.removeRow(row); } </script></div><div class="form-group col-md-11"> @Html.LabelFor(model => model.UserDetailId) @Html.EditorFor(model => model.UserDetailId) @Html.ValidationMessageFor(model => model.UserDetailId)</div><div class="form-group col-md-11"> @Html.LabelFor(model => model.EffectiveFromDate) @Html.EditorFor(model => model.EffectiveFromDate) @Html.ValidationMessageFor(model => model.EffectiveFromDate)</div><div class="form-group col-md-11"> @Html.LabelFor(model => model.EffectiveToDate) @Html.EditorFor(model => model.EffectiveToDate) @Html.ValidationMessageFor(model => model.EffectiveToDate)</div><div class="form-group col-md-11"> @Html.LabelFor(model => model.FirstName) @Html.EditorFor(model => model.FirstName) @Html.ValidationMessageFor(model => model.FirstName)</div>@Html.HiddenFor(model => model.TeamMemberId)@Html.KendoScripts()<input id="Username" name="Username" data-val="true" data-bind="value:Username" type="hidden" value=""><input id="FirstName" name="FirstName" data-val="true" data-bind="value:FirstName" type="hidden" value=""><input id="LastName" name="LastName" data-val="true" data-bind="value:LastName" type="hidden" value=""> function onUserAutoCompleteChange(e) { var dataItem = $("#@this.ViewData.ModelMetadata.PropertyName").data("kendoDropDownList").dataItem(); $("#Username").val(dataItem.Username); $("#FirstName").val(dataItem.FirstName); $("#LastName").val(dataItem.LastName); }</script>/// <summary>/// For use with Kendo Grid ajax binding/// Creates new models by inserting the data posted by the Kendo Grid into the grid datasource./// </summary>/// <param name="products">The model created by the user.</param>/// <returns>The inserted model so the Kendo Grid is aware of the newly generated model</returns>[HttpPost]public virtual ActionResult AddMember([DataSourceRequest]DataSourceRequest request, TeamMemberModel model){ return Json(new[] { model }.ToDataSourceResult(request, ModelState));}@{ Html.Kendo().Grid<InvoiceSummaryDto>() .Name("invoiceAccountingGrid") .Columns(columns => { columns.Bound(l => l.Id).ClientTemplate("<a href='" + @Url.Action("Details", "Invoice", new { area = "Accounting" }) + "/#= Id #'" + ">" + @Html.GetUserFormattedId(@"#= Id #") + "</a>").Title("ID"); columns.Bound(l => l.ItemsDescription).Title("Description"); }).Resources(resource => { resource.Add(m => m.Color) // Need this to be a color picker .Title("Color") .DataTextField("Name") .DataValueField("ColorID")<div class="k-edit-label"> @(Html.LabelFor(model => model.IsAllDay))</div><div data-container-for="isAllDay" id="is-all-day" class="k-edit-field"> <input data-bind="checked: isAllDay" data-val="true" id="isAllDay" name="isAllDay" type="checkbox" /></div>$(function () { $("#isAllDay").change(function () { alert("changed changed"); });});<div class="k-edit-label"> @(Html.LabelFor(model => model.IsAllDay))</div><div data-container-for="isAllDay" id="is-all-day" class="k-edit-field"> <input data-bind="checked: isAllDay, events: { change: isAllDayChanged}" data-val="true" id="isAllDay" name="isAllDay" type="checkbox" /></div>function isAllDayChanged() { alert("changed");}control.value("1");
<script> function SelectedCedingCompany() { return { CedingCompanyId: $("#CedingCompanyId").val() }; } function SelectedCedingCompanyLine() { return { CedingCompanyLineId: $("#CedingCompanyLineId").val() }; } function CoveredLinesAndSublinesGridBeginEdit(e) { var control = e.container.find('#CedingCompanyStateId').data('kendoDropDownList'); control.enable(); control.value("1"); }</script>@(Html.Kendo().Grid<ContractScope>() .Name("CoveredLinesAndSublinesGrid") .Columns(columns => { columns.ForeignKey(c => c.CedingCompanyId, (System.Collections.IEnumerable)ViewBag.CedingCompanies, "CedingCompanyId", "CompanyName") .Width(100).Title("Ceding Company") .EditorTemplateName("Contract/ContractScopeCedingCompanyDropDown"); columns.ForeignKey(c => c.CedingCompanyStateId, (System.Collections.IEnumerable)ViewBag.CedingCompanyStates, "CedingCompanyStateId", "CedingCompanyStateDescription") .Width(50).Title("State") .EditorTemplateName("Contract/ContractScopeCedingCompanyStateDropDown"); columns.Command(command => { command.Custom("Edit").SendDataKeys(true); command.Edit(); }).Width(150); }) .ToolBar(tb => tb.Template( @<text> <a class='k-button k-button-icontext k-grid-add ActionButton' href="#" style="padding-top:2px; padding-bottom:4px;"> <span class="k-icon k-add"></span>Add Covered Line / Sublines </a> </text>)) .Scrollable(s=>s.Height(300)) .Editable(editable => editable.Mode(GridEditMode.InLine)) .Events(events => events.Edit("CoveredLinesAndSublinesGridBeginEdit")) .DataSource(dataSource => dataSource .Ajax() .Filter(filter => filter.Add(e => e.ContractId).IsEqualTo(contractID)) .Events(events => events.Error("AjaxFailure")) .Model(model => { model.Id(p => p.ContractScopeId); model.Field(p => p.ContractId).Editable(false); model.Field(p => p.ContractScopeId).Editable(false); model.Field(p => p.CedingCompanyId); model.Field(p => p.CedingCompanyStateId); }) .Read(read => read.Action("Read", "CoveredLines", new { area = "Contract" }).Type(HttpVerbs.Post)) .Create(create => create.Action("New", "CoveredLines", new { area = "Contract", id = contractID }).Type(HttpVerbs.Post)) .Update(update => update.Action("Update", "CoveredLines", new { area = "Contract" }).Type(HttpVerbs.Post)) .PageSize(20) ) )@(Html.Kendo().DropDownList() .HtmlAttributes(new { id = "CedingCompanyId"}) .DataTextField("CompanyName") .DataValueField("CedingCompanyId") .Name("CedingCompanyId") .DataSource(source => source .Read(read => read.Action("GetCedingCompanies", "CoveredLines", new { area = "Contract" }) .Type(HttpVerbs.Post)) .ServerFiltering(true)))@( Html.Kendo().DropDownList() .HtmlAttributes(new { id = "CedingCompanyStateId"}) .DataTextField("CedingCompanyStateDescription") .DataValueField("CedingCompanyStateId") .Name("CedingCompanyStateId") .DataSource(source => source .Read(read => read.Action("GetCedingCompanyStates", "CoveredLines", new { area = "Contract" }) .Type(HttpVerbs.Post) .Data("SelectedCedingCompany")) .ServerFiltering(true)) .Enable(true) .AutoBind(false) .CascadeFrom("CedingCompanyId"))<div class="chart-wrapper"> @(Html.Kendo().Chart(Model.SeriesData) .Name("chart") .Title("Test Chart") .Legend(legend => legend .Visible(false) ) .SeriesDefaults(seriesDefaults => seriesDefaults.Bar().Stack(ChartStackType.Normal) ) .CategoryAxis(axis => axis .Categories("Bob Jones", "Sarah Giant") .MajorGridLines(lines => lines.Visible(false)) ) .ValueAxis(axis => axis .Numeric() .Line(line => line.Visible(false)) .MajorGridLines(lines => lines.Visible(true)) ) .Series(series => { series.Bar(new double[] { 10, 17 }).Color("#f3ac32"); series.Bar(new double[] { 30, 27 }).Color("#b8b8b8"); series.Bar(new double[] { 10, 17 }).Color("#e3ac32"); series.Bar(new double[] { 30, 27 }).Color("#ab6e36"); }) .Tooltip(tooltip => tooltip .Visible(true) .Template("#= series.name #: #= value #") ) )</div>@model LyncMeetingReporting.Report.Controllers.ChartModel<div class="chart-wrapper"> @(Html.Kendo().Chart(Model.SeriesData) .Name("chart") .Title("Test Chart") .Legend(legend => legend .Visible(false) ) .SeriesDefaults(seriesDefaults => seriesDefaults.Bar().Stack(ChartStackType.Normal) ) .CategoryAxis(axis => axis .Categories(Model.Attendees) .MajorGridLines(lines => lines.Visible(false)) ) .ValueAxis(axis => axis .Numeric() .Line(line => line.Visible(false)) .MajorGridLines(lines => lines.Visible(true)) ) .Series(series => { series.Bar(m => m.Data, m => m.Colour); }) .Tooltip(tooltip => tooltip .Visible(true) .Template("#= series.name #: #= value #") ) )</div>public ActionResult Log(Guid? id, MeetingDetailsType? type){ var chartModel = new ChartModel() { Attendees = new string[] { "Bob Jones", "Sarah Giant" }, SeriesData = new SeriesData[] { new SeriesData() { Colour = "#f3ac32", Data = new double[] { 10, 17 }}, new SeriesData() { Colour = "#b8b8b8", Data = new double[] { 30, 27 }}, new SeriesData() { Colour = "#e3ac32", Data = new double[] { 10, 17 }}, new SeriesData() { Colour = "#a8b8b8", Data = new double[] { 30, 17 }}, } }; return View(chartModel);}public class ChartModel{ public IEnumerable<string> Attendees { get; set; } public IEnumerable<SeriesData> SeriesData { get; set; }}public class SeriesData{ public double[] Data {get; set;} public string Colour {get; set; }}