or
// the controller // called by Index2: returns a list of BatchHeader objects directly from the ROAMHostSvc public ActionResult FetchBatchList2() { DateTime aDate = new DateTime(0001, 1, 1); ROAMHostSvc.Notification messages1 = null; ROAMHostSvc.ROAMHostSvcClient hostSvc = null; KUI_CS_Test1.ROAMHostSvc.BatchHeader[] batchArr; //List<KUI_CS_Test1.ROAMHostSvc.BatchHeader> batchCollection = new List<BatchHeader>(); try { hostSvc = new ROAMHostSvc.ROAMHostSvcClient(); batchArr = hostSvc.GetBatchCollection(ref messages1, false, aDate, aDate, false, aDate, aDate); // assign the objects in the array to the List collection //for (int i = 0; i <= batchArr.Length - 1; i++) //{ // batchCollection.Add(batchArr[i]); //} //return View(batchCollection); //return PartialView(batchCollection); //return PartialView(Json(batchCollection, JsonRequestBehavior.AllowGet)); return Json(batchArr, JsonRequestBehavior.AllowGet); } catch (Exception ex) { return null; } finally { Close_WCF_Service(ref hostSvc); } } private void Close_WCF_Service(ref ROAMHostSvc.ROAMHostSvcClient hostSvc) { try { if ((hostSvc != null)) { if (hostSvc.State == System.ServiceModel.CommunicationState.Opened) { hostSvc.Close(); hostSvc = null; } } } catch (Exception ex) { throw; } } }//the view@model KUI_CS_Test1.ROAMHostSvc.BatchHeader[]@{ ViewBag.Title = "Index1";}<h2>Index1</h2>@(Html.Kendo().Grid(Model) .Name("batchGrid") .Columns(columns => { columns.Bound(b => b.BatchID); columns.Bound(b => b.Transmitted_DateTime); columns.Bound(b => b.Completed_DateTime); columns.Bound(b => b.Created_DTTM); columns.Bound(b => b.Created_EmpID); } ) .DataSource(dataSource => dataSource .Ajax() .Read(read => read.Action("FetchBatchList2", "Home")) ))@(Html.Kendo() .Grid<Shell.UI.UGOBooks.Models.GetAcreageData_Result>() .Name("AcreageGrid") .HtmlAttributes(new { style="height: 650px" }) .Columns(columns => { columns.Bound(a => a.DataFieldText); columns.Bound(a => a.UOMText) .HeaderHtmlAttributes(new { style="text-align:center" }) .HtmlAttributes(new { style="text-align:center" }) .Width(100); columns.Bound(a => a.DataFieldValue) .HeaderHtmlAttributes(new { style="text-align:right" }) .HtmlAttributes(new { title="#= TooltipText#", style="text-align:right" }) .Width(100); columns.Bound(a => a.DataFieldTextValue) .HtmlAttributes(new { title="#= TooltipText#" }) .Width(200); columns.Bound(a => a.Comments); }) .ToolBar(toolbar => { toolbar.Save(); }) .Events(e => { e.Edit("onAcreageEdit"); e.DataBound("onGridDataBound"); e.SaveChanges("acreageSaveChanges"); }) .Editable(editable => editable.Mode(GridEditMode.InCell)) .DataSource(dataSource => dataSource .Ajax() .Batch(true) .PageSize(20) .ServerOperation(false) .Model(model => { model.Id(a => a.AcreageDataId); }) .Read(read => read.Action("AcreageRead", "Databooks").Data("gridReadParams")) .Update(update => update.Action("AcreageUpdate", "Databooks"))) .Pageable() )
