Hello all,
I have a view that contains a Kendo Grid. The grid is bound to the model, and the model is a ClaimsViewModel. The view model contains a List<Claims> and the grid is bound to the list. This currently displays a list of claims and seems to be working. I want the UI user to be able to select a single claim(row) and then view that claim detail on a detail view. I have the row selection set to single, I have the change event set to javascript that should be able to pull the claimno, and send that to an action that would pass the value to the detail view.
However, the row selection is not firing. Please help.
This is the claims View
@using ProviderPortal.ViewModels;
@using Kendo.Mvc.UI
@model ClaimsViewModel
@{
ViewBag.Title = "SearchClaims";
Layout = "~/Views/Shared/_Layout.cshtml";
}
@(Html.Kendo().Grid(Model.Claims)
.Name("Grid")
.Events(events => events.Change("itemselected"))
.Columns(columns =>
{
columns.Bound(p => p.ClaimNo).Title("Claim #").Width(130);
columns.Bound(p => p.ServiceDt).Title("Incurred From-To").Width(150);
columns.Bound(p => p.TotalCharge).Title("Total Charge").Width(130);
columns.Bound(p => p.TotalPaid).Title("Pd Amt").Width(130);
columns.Bound(p => p.Name).Title("Patient Name").Width(230);
})
.Scrollable()
.Selectable(selectable => selectable
.Enabled(true)
.Mode(GridSelectionMode.Single)
)
.PersistSelection(true)
.Navigatable()
.HtmlAttributes(new { style = "height: 700px;" })
.DataSource(dataSource => dataSource
.Server()
.Model(m => { m.Id(p => p.ClaimNo); })
)
)
<script type="text/javascript">
function itemselected(e) {
var selectedRow = this.select();
var dataItem = this.dataItem(selectedRow);
var id;
id = dataItem.ClaimNo;
window.location.href = "@Url.Action( "Claims", "DisplayClaim")" + "?ClaimID=" + id;
}
</script>
Here is the Controller
public class ClaimsController : Controller { // GET: Claims public ActionResult Index() { return View(); } [HttpPost] public ActionResult SearchClaims(string FromDt, string ToDt, string PatAcct, string policynumber, string GrpNo, string ClientCode, string ProvTaxID) { CIAWebService.CIAServiceClient wref = new CIAWebService.CIAServiceClient(); var viewModel = new ClaimsViewModel(); try { if (String.IsNullOrEmpty(ProvTaxID)) { ProvTaxID = Session["ProvTaxId"].ToString(); } var MMDarray = wref.MemberLookup("P", policynumber, "G", null, null, null, null); if (MMDarray.Length > 0) { Session.Add("MemberData", MMDarray[0]); var claimHeader = wref.ClaimHeader(Int32.Parse(MMDarray[0].SeqNum), MMDarray[0].DependentCode, MMDarray[0].DB, GrpNo, "C", null, DateTime.Parse(FromDt), DateTime.Parse(ToDt), ProvTaxID); for (int i = 1; i < claimHeader.Length; i++) { if (claimHeader[i].PatAcct == PatAcct) { viewModel.Claims.Add(BuildClaimsModel(MMDarray[0], claimHeader[i])); } } } } catch (Exception Ex) { Log4.Error("ClaimsController - SearchClaims:", Ex); ViewBag.ErrMessage = "Error: " + Ex.ToString(); } HttpContext.Session.Add("ClaimsList", viewModel.Claims); return View(viewModel); } }
and here is the view model
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace ProviderPortal.ViewModels
{
public class ClaimsViewModel: BaseViewModel
{
public List<ClaimData> Claims { get; set; }
public ClaimsViewModel()
{
Claims = new List<ClaimData>();
}
}
}