[OutputCache(Duration = 0)] public JsonResult Inventory_Read([DataSourceRequest] DataSourceRequest request) { var vDealershipsid = 1; using (var context = new VehicleSalesProdEntities()) { // Perform data access using the context var myinvdata = context.Inventory.Select(a => a.DealershipsDealerId == vDealershipsid); return Json(myinvdata, JsonRequestBehavior.AllowGet); } }
@( Html.Kendo().Grid<POVSalesPlus.Areas.Inventory.Models.InventoryViewModel>() .Name("InventoryGrid") .Columns(column => { column.Bound(m => m.Id); column.Bound(m => m.Year); column.Bound(m => m.Make); column.Bound(m => m.Model); column.Command(command => { command.Custom("edit").Text("Edit").Click( @<text> function(e) { @*var dataItem = this.dataItem($(e.currentTarget).closest("tr")); var url = "@Url.Action("Edit", "Employee", new { area = "RMS" })/" + dataItem.Id; window.location.href=url;*@ } </text> ); command.Custom("delete").Text("Delete").Click( @<text> function(e) { @*if (confirm("Are you sure you want to delete this employee?")) { var dataItem = this.dataItem($(e.currentTarget).closest("tr")); var options = { url: "@Url.Action("Delete", "Employee", new { area = "RMS" })", type: "Post", data: $('<form>@Html.AntiForgeryToken()<input id="id" name="id" type="text" value="' + dataItem.Id + '" /></form>').serialize() }; $.ajax(options).done(function(){ $("#InventoryGrid").data("kendoGrid").dataSource.read(); }); }*@ } </text> ); }); }) .Editable(editable => editable.Mode(GridEditMode.InLine)) .Pageable() .Sortable() .DataSource(dataSource => dataSource .Ajax() .PageSize(20) .Model(model => model.Id(p => 1)) .Read(read => read.Action("Inventory_Read", "Inventory")) .Model(model => { model.Id(m => m.Id); }) ) )
public class InventoryViewModel : Controller { [Required] public int Id { get; set; } public string Year { get; set; } public string Make { get; set; } public string Model { get; set; } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)