or
Html.Kendo().Grid<SelectedProjects>()
.Name("StaticViewGrid")
.HtmlAttributes(new { @style = "display:inline-block;" })
.Columns(columns =>
{
columns.Bound(o => o.Selected);
columns.Bound(o => o.SystemID);
columns.Bound(o => o.ProjectName);
columns.Bound(o => o.Environment);
columns.Bound(o => o.SitEntryDate).Format("{0:d}");
columns.Bound(o => o.SitExitDate).Format("{0:d}");
columns.Bound(o => o.ProductionInstallDate).Format("{0:d}");
})
.ToolBar(toolbar => toolbar.Save())
.Editable(editing => editing.Mode(Kendo.Mvc.UI.GridEditMode.InCell))
.Filterable()
.Sortable()
.DataSource(dataSource => dataSource
.Ajax()
.Batch(true)
.ServerOperation(false)
.Model(model =>
{
model.Id(o => o.EngagementID);
model.Field(o => o.Selected).Editable(true);
model.Field(o => o.SystemID).Editable(false);
model.Field(o => o.ProjectName).Editable(false);
model.Field(o => o.Environment).Editable(false);
model.Field(o => o.SitEntryDate).Editable(false);
model.Field(o => o.SitExitDate).Editable(false);
model.Field(o => o.ProductionInstallDate).Editable(false);
})
.Read(read => read.Action("SelectedEngagementItemData", "Amethyst"))
.Update(update => update.Action("SelectedEngagementItems_Update", "Amethyst"))
)
public partial class SelectedProjects
{
public Guid EngagementViewID { get; set; }
public string EngagementViewName { get; set; }
public bool Selected { get; set; }
public int EngagementID { get; set; }
public Nullable<int> SystemID { get; set; }
public string ProjectName { get; set; }
public string Environment { get; set; }
public Nullable<DateTime> SitEntryDate { get; set; }
public Nullable<DateTime> SitExitDate { get; set; }
public Nullable<DateTime> ProductionInstallDate { get; set; }
}
@(Html.Kendo().Grid<JobCodeModel>() .Name("JobCodeGrid") .ToolBar(toolbar => toolbar.Create()) .Scrollable(scrolling => scrolling.Enabled(false)) .Filterable(filtering => filtering.Enabled(true)) .Pageable(paging => paging.Enabled(true).PageSizes(true)) .Sortable(sorting => sorting.Enabled(true)) .Editable(editing => editing.Mode(Kendo.Mvc.UI.GridEditMode.InLine)) .DataSource(datasource => datasource .Ajax() .Read(read => read.Action("JobCode_Read", "Admin")) .Create(create => create.Action("JobCode_Create", "Admin")) .Update(update => update.Action("JobCode_Update", "Admin")) .Model(model => model.Id(p => p.JobCodeID)) ) .Columns(columns => { columns.Bound(c => c.JobCode); columns.Bound(c => c.JobCodeDescription); columns.Bound(c => c.Active); columns.Command(commands => { commands.Edit(); }).Width(43).Visible(true); }) )[HttpPost] public ActionResult JobCode_Read([DataSourceRequest]DataSourceRequest request) { DataSourceResult result = null; using (MyEntities entities = new MyEntities()) { result = (from r in entities.JobCodes select new JobCodeModel { JobCodeID = r.JobCodeID, JobCode = r.JobCode1, JobCodeDescription = r.JobCodeDescription, Active = r.Active }).ToDataSourceResult(request); } return Json(result); }<script> $(document).ready(function () { var crudServiceBaseUrl = "http://localhost/IqaRestService/Service1", dataSource = new kendo.data.DataSource({ transport: { read: { url: crudServiceBaseUrl + "/getquestions", dataType: "json" }, update: { url: crudServiceBaseUrl + "/update", dataType: "json", type: "POST", contentType: "application/json" }, create: { url: crudServiceBaseUrl + "/create", dataType: "json", type: "POST", contentType: "application/json" }, destroy: { url: crudServiceBaseUrl + "/delete", dataType: "json", type: "DELETE", contentType: "application/json" }, parameterMap: function (options, operation) { if (operation !== "read" && options) { return kendo.stringify({ question: options }); } } }, schema: { model: { id: "QuestionId", fields: { QuestionId: { type: "string" }, QuestionText: { type: "string" }, Comment: { type: "string" }, Answer: { type: "string" } } } } }); $(".k-add-button").click(function (e) { listView.add(); e.preventDefault(); }); var listView = $("#listView").kendoListView({ dataSource: dataSource, editable: true, selectable: "single", template: kendo.template($("#template").html()), editTemplate: kendo.template($("#editTemplate").html()) }).data("kendoListView"); }); </script>[OperationContract] [WebGet(ResponseFormat = WebMessageFormat.Json, UriTemplate = "/getquestions")] public List<IqaQuestion> GetQuestions() { return this.Store; } [OperationContract] [WebInvoke(Method = "POST", UriTemplate = "/update", BodyStyle = WebMessageBodyStyle.WrappedRequest)] public bool SaveQuestion(IqaQuestion question) { return true; } [OperationContract] [WebInvoke(Method = "POST", UriTemplate = "/create", BodyStyle = WebMessageBodyStyle.WrappedRequest)] public bool CreateQuestion(IqaQuestion question) { return true; } [OperationContract] [WebInvoke(Method = "DELETE", UriTemplate = "/delete", BodyStyle = WebMessageBodyStyle.WrappedRequest)] public bool RemoveQuestion(IqaQuestion question) { return false; }column.Bound(o => o.Color).Title("Color").Filterable(filterable => filterable.UI("colorFilter"));function colorFilter(element) {element.kendoDropDownList({
dataSource: { transport: { read: "@Url.RouteUrl("ProductData", new { action = "FilterMenuCustomization_Colors", controller = "Inventory", catagory = "XYZ" })" , type: "POST" , data: { catagory: "@ViewData["productType"].ToString()", filters: $("#Products").data.filter } } }, optionLabel: "--Select Value--"}); }@(Html.Kendo().Grid<DSG.Support.EntityModel.Models.SolutionFeedback>() .Name("KBFeedbackGrid") .Columns(columns => { columns.Bound("solution_id").Title("KB#"); columns.Command(act => act.Custom("Edit")); columns.Bound("site_id").Title("Acc ID"); columns.Bound("site_name").Title("Account Name"); columns.Bound("rating_score").Title("Rating").HtmlAttributes(new { @class = "ratingCol" }); columns.Bound("date_time").Title("Created").Format("{0:MM/dd/yyyy HH:mm}"); columns.Bound("comments").Title("Comment"); columns.Bound("action_taken").Title("Action"); }) .DataSource(dataSource => dataSource.Ajax() .Read(read => read.Action("Query", "KBFeedback").Data("GetSearchCriteria")) .Sort(sort => sort.Add(x => x.date_time)) ) .Pageable() .Sortable(sort => sort.AllowUnsort(false).Enabled(true).SortMode(GridSortMode.SingleColumn)))public JsonResult Query(DataSourceRequest request, KBFeedbackSearchCriteria query){ // Here request contains the page number and page size but the Sorts collection is null int count = 42; // Get count from linq query IEnumerable<SolutionFeedback> results = null; // Get data from linq query return Json(new DataSourceResult() { Data = results, Total = count }, JsonRequestBehavior.AllowGet);}@Scripts.Render("~/bundles/modernizr")<!--This bundle was moved by the Kendo UI VS Extensions for compatibility reasons-->@Scripts.Render("~/bundles/jquery")<!--This CSS entry was added by the Kendo UI VS Extensions for compatibility reasons--><link href="@Url.Content("~/Content/kendo.compatibility.css")" rel="stylesheet" type="text/css" /><link href="@Url.Content("~/Content/kendo/2012.3.1315/kendo.common.min.css")" rel="stylesheet" type="text/css" /><link href="@Url.Content("~/Content/kendo/2012.3.1315/kendo.dataviz.min.css")" rel="stylesheet" type="text/css" /><link href="@Url.Content("~/Content/kendo/2012.3.1315/kendo.default.min.css")" rel="stylesheet" type="text/css" /><link href="@Url.Content("~/Content/kendo/2012.3.1315/kendo.dataviz.default.min.css")" rel="stylesheet" type="text/css" /><script src="@Url.Content("~/Scripts/kendo/2012.3.1315/jquery.min.js")"></script><script src="@Url.Content("~/Scripts/kendo/2012.3.1315/kendo.all.min.js")"></script><script src="@Url.Content("~/Scripts/kendo/2012.3.1315/kendo.aspnetmvc.min.js")"></script><script src="@Url.Content("~/Scripts/kendo.modernizr.custom.js")"></script>