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>}
The e-Shram card bridges the gap between unorganized workers and social security benefits in India. This unique ID system allows the government to connect with these workers and offer them much-needed support. Registering is straightforward - visit eshramcard.info and provide your details. E-Shram card benefits include financial assistance and the ability to participate in government programs. e Shram card Download
Ullu's rising stars, including Ankita Dave, Priya Gamre, and Aayushi Jaiswal, have captivated audiences with their bold and sensual performances, contributing to the platform's success. From established names like Natasha Rajeshwari to emerging talents like Pihu Kanojiya, the platform's diverse cast of actresses has redefined the boundaries of OTT content. With their talent, versatility, and on-screen chemistry, these actresses have played a crucial role in Ullu's popularity and growth. Ruks Khandagale has been at the center of some controversies surrounding the explicit nature of certain Ullu web series, sparking debates about censorship and artistic freedom. Read more here Top 10 Ullu Web Series Actresses
That's good solution. It's so amazed flagle
Hi Thomas,
Thanks for getting back to us.
I am glad that you managed to resolve your issue.
Thank you for choosing Infragistics components!
Yeah that was it. I wasn't having success, tried the latest SR which didn't change any behavior. I output the table as an XML file in the razor page and the SP's were different between my development machine and the deployed machine. Thanks.
I checked the function that's crashing and the only place I found it could possibly throw out of range is this:
int tableColIndex = dataRowView.Row.Table.Columns.IndexOf(columns[i].Key);
... dict.Add(columns[i].Key, dataRowView.Row.ItemArray[tableColIndex]);
This code repeats for each row in the table and for each column (after passing filtering if that matters) and if the table contains rows that don't contain some columns, it could very well explain it because tableColIndex would be -1 and there is no check for that.
Could you please check the DataTable result from SQL and see if this is the case?