Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
20
igGrid ASP.NET MVC Index was outside the bounds of the array on binding
posted

I am trying to redeploy a solution from about 3 years ago.   It uses Ignite for ASP.NET MVC (not core).   Works fine locally and during deployment gives the error Index was outside the bounds of the array on binding.

The cshtml page that errors is below, I have verified that the SQL data in the controller does have values, and verified all .js and .css files are available and no errors in the pages that call controller for this view.  This is using version 17.1.20171.2029 of igGrid.   The error occurs on line 37 below, any help is appreciated:

@using Infragistics.Web.Mvc
@using System.Data.Entity.Core.Objects
@using System.Data;
@using MeditechLegacyMVC.Models;
@model DataTable
@{
Layout = "~/Views/Shared/_LayoutPatient.cshtml";
ViewBag.Title = "Patient Visit Scanned Documents";
TempData.Keep();
string accountNumber = TempData["AccountNumber"].ToString();
}

<!-- Ignite UI Required Combined CSS Files -->
<link href="@Url.Content("~/igniteui/css/themes/infragistics/infragistics.theme.css")" rel="stylesheet" />
<link href="@Url.Content("~/igniteui/css/structure/infragistics.css")" rel="stylesheet" />

<script src="@Url.Content("~/js/modernizr.min.js")"></script>
<script src="@Url.Content("~/js/jquery.min.js")"></script>
<script src="@Url.Content("~/js/jquery-ui.min.js")"></script>

<!-- Ignite UI Required Combined JavaScript Files -->
<script src="@Url.Content("~/igniteui/js/infragistics.core.js")"></script>
<script src="@Url.Content("~/igniteui/js/infragistics.lob.js")"></script>
<h2>Scanned Documents</h2>
<br />
@using (Html.BeginForm("DocumentListPrint", "Patient", FormMethod.Post))
{
<div class="input-group">
<div class="input-group">
<p>Select documents with check box then use print button below to print them</p>
<br />
<button id="print" type="submit" class="btn btn-primary btn-default">Print</button>
</div>
</div>
<div class="row">
<br />
@(Html.Infragistics().Grid<ScaPatientDocument>     <------- Error line
(Model)
.PrimaryKey("DocumentNumber")
.ID("documentsGrid")
.Width("100%")
.AutoGenerateColumns(false)
.DataSource(Model)
.Features(feature =>
{
feature.Responsive()
.EnableVerticalRendering(false)
.ReactOnContainerWidthChanges(true);
feature.Sorting().Type(OpType.Local).Mode(SortingMode.Multiple);
feature.Paging().Type(OpType.Local);
feature.Filtering().Type(OpType.Local);
feature.Selection().MultipleSelection(true);
feature.RowSelectors()
.EnableCheckBoxes(true)
.EnableSelectAllForPaging(true);
})
.Columns(column =>
{
//Need to add checkbox for printing

column.For(x => x.DocumentNumber).HeaderText("DocumentNumber").Hidden(true);
column.For(x => x.AccountNumber).HeaderText("AccountNumber").Hidden(true);
column.For(x => x.Category).HeaderText("Category").Width("20%");
column.For(x => x.DocumentName).HeaderText("Document Name").Width("50%")
.Template("<a href=\"../Patient/Document?accountNumber=${AccountNumber}&documentNumber=${DocumentNumber}&pageNumber=1\" target=\"_blank\">${DocumentName}</a>");
column.For(x => x.Date).HeaderText("Document Date").Width("20%");
column.For(x => x.PageCount).HeaderText("Page Count").Width("12%");
})
//.DataSourceUrl(Url.Action("VisitList"))
.DataBind()
.Render()
)
</div>
<input id="accountNumber" name="accountNumber" hidden value="@accountNumber" />
@(Html.Hidden("selectedRowsPKs"))
<script>
$(function () {
$("#print").click(function () {
var rows = $('#documentsGrid').igGridSelection('selectedRows');
var ids = [rows.length];

for (var i = 0; i < rows.length; i++) {
ids[i] = rows[i].id;
}

$("#selectedRowsPKs").val(ids);
});
});
</script>
}