or
RouteValueDictionary routeValues = this.GridRouteValues();return RedirectToAction("Index", routeValues);I am taking an existing project and adding KendoUI in place of Grid's by another vendor.
The project uses IoC, UnitOfWork etc and so the MVC controllers do not directly use the Context and I cannot see the ToDataSourceResult method.
I have got it mostly working using .Server(), but now want to start using Ajax.
What does ToDataSourceResult do, and how can I replicate its functionality?
When any of the ${} below are null, or not provided, it wraps as if the <dd></dd> doesn't exist.
How do I handle the if(${MiddleName}) !== NULL) then ${MiddleName} for example...
<div class="contact-research-view">
<dl>
<dt>Conact Id:</dt><dd>${ContactId}</dd>
<dt>Honorific:</dt><dd>${Honorific}</dd>
<dt>First Name:</dt><dd>${FirstName}</dd>
<dt>Middle Name:</dt><dd>${MiddleName}</dd>
<dt>Last Name:</dt><dd>${LastName}</dd>
<dt>Suffix:</dt><dd>${Suffix}</dd>
<dt>Primary Address Line 1:</dt><dd>${PrimaryAddressLine1}</dd>
<dt>Primary Address Line 2:</dt><dd>${PrimaryAddressLine2}</dd>
<dt>Primary Address City:</dt><dd>${PrimaryAddressCity}</dd>
<dt>Primary Address StateOrProvince:</dt><dd>${PrimaryAddressStateOrProvince}</dd>
<dt>Primary Address PostalCode:</dt><dd>${PrimaryAddressPostalCode}</dd>
<hr/>
<dt>Account Address Line 1:</dt><dd>${AccountAddressLine1}</dd>
<dt>Account Address Line 2:</dt><dd>${AccountAddressLine2}</dd>
<dt>Account Address City:</dt><dd>${AccountAddressCity}</dd>
<dt>Account Address StateOrProvince:</dt><dd>${AccountAddressStateOrProvince}</dd>
<dt>Account Address PostalCode:</dt><dd>${AccountAddressPostalCode}</dd>
</dl>
</div>
function onchange(e) { var lst = $("#lstLPG").data("kendoListView"); }<div class="k-toolbar k-grid-toolbar"> <a id="addRoleButton" class="k-button k-button-icontext k-add-button" href="#"><span class="k-icon k-add"></span>Add new Role</a></div> @(Html.Kendo().ListView<iProjX.Models.RoleModel>(Model.Roles) .Name("rolesListView") .TagName("div") .ClientTemplateId("rolesList") .Editable() .Pageable() .DataSource(dataSource => dataSource .Model(model => { model.Id("RoleId"); model.Field(f => f.ProjectId).DefaultValue(Model.ProjectId); model.Field(f => f.Title); model.Field(f => f.Description);; }) .Events(e => e .Error("rolesListViewData_error") .Change("rolesListViewData_change") .RequestStart("rolesListViewData_requestStart")) .Create(create => create.Action("createRole", "Project")) .Read(read => read.Action("getRoles", "Project", new { projectId = Model.ProjectId })) .Update(update => update.Action("updateRole", "Project")) .PageSize(30) ) .Events(e => e .Change("rolesListView_change") .Edit("rolesListView_edit") .DataBound("rolesListView_databound")) )//View template<script type="text/x-kendo-template" id="rolesList"> <div class="roleView" > <div> ${Title} </div> <div> ${Description} </div> <div class="edit-buttons"> <a class="k-button k-button-icontext k-edit-button" href="\\#"><span class="k-icon k-edit"></span>Edit</a> <a class="k-button k-button-icontext k-delete-button" href="\\#"><span class="k-icon k-delete"></span>Delete</a> </div> </div></script>@model iProjX.Models.RoleModel<div class="roleView" id = "newRoleForm2" > @Html.ValidationSummary(true) @Html.HiddenFor(model => model.ProjectId) @Html.HiddenFor(model => model.RoleId) <div class="editor-label"> @Html.LabelFor(model => model.Title) </div> <div class="editor-field"> @Html.TextBoxFor(model => model.Title, new { style = "width:99%", maxlength = 100 }) <span data-for="Title" class="k-invalid-msg"></span> </div> <div class="editor-label"> @Html.LabelFor(model => model.Description) </div> <div class="editor-field"> @Html.TextAreaFor(model => model.Description, new { style = "width:100%; height:100px"}) <span data-for="Description" class="k-invalid-msg"></span> </div> <div class="edit-buttons"> <a class="k-button k-button-icontext k-update-button" onclick="updateClick()" href="\\#"><spanclass="k-icon k-update"></span>Save</a> <a class="k-button k-button-icontext k-cancel-button" href="\\#"><span class="k-icon k-cancel"></span>Cancel</a> </div></div>public ActionResult BulkEdit([DataSourceRequest]DataSourceRequest request) { var NewAssets = db.TurnaroundDumps; DataSourceResult result = NewAssets.ToDataSourceResult(request); return Json(result, JsonRequestBehavior.AllowGet); }@(Html.Kendo().Grid<PcInventory_v1_1.Models.TurnaroundDump>() .Name("Grid") .Columns(columns => { columns.Bound(p => p.AssetTag); columns.Bound(p => p.SerialNumber); columns.Bound(p => p.DeptId); columns.Bound(p => p.Location); }) .DataSource(dataSource => dataSource .Ajax() // Specify that the data source is of ajax type .Read(read => read.Action("BulkEdit", "Assets")) // Specify the action method and controller name ) .Pageable() )