基础设施igGrid导致MissingManifestResourceException错误

时间:2019-01-29 16:37:06

标签: asp.net-core-mvc infragistics iggrid

平台详细信息:IgniteUI,C#,Asp.Net Core 2.0(MVC),HTML5和基本JS

我需要帮助来了解此错误是什么以及为什么引发该错误。我已经尝试过使用Google搜索,但是我发现的唯一信息指向事物被无序加载。我们在其他地方使用iggrid没有问题,因此我认为库和程序集(和顺序)已涵盖其中。该错误显示为:

“ MissingManifestResourceException:找不到适合于指定区域性或中性区域性的任何资源。请确保” Infragistics.Web.Mvc.Resources.CommonStrings.resources“已正确嵌入或链接到程序集” Infragistics.Web.AspNetCore“在编译时,或者所需的所有附属程序集均已加载并且已完全签名。”

页面使用一个文件并以网格形式提供反馈。计算反馈,并将其通过视图模型传递到页面。这是视图模型:

namespace GCFF.Web.Models
{
    public class MassUploadViewModel
    {
        public int? recordsRead { get; set; }
        public int recordsModified { get; set; }
        public int recordsUnmodifiedCancelSAP { get; set; }
        public int recordsUnmodifiedAmount { get; set; }
        public int failedMultiple { get; set; }
        public int failedNoMatch { get; set; }
        public GridModel FailedItemsGrid { get; set; }
    }
}

在控制器中,我设置了每个属性,调用了设置网格属性的方法,构建了一个列表并将其设置为数据源,然后返回模型。这是其中的一些代码:

var failedRequestsList = new List<MassUploadRequest>();
foreach (MassUploadRequest m in requests.Where(t => t.Response == "Failed - Matched Multiple")) {
    failedRequestsList.Add(m);
}

model.recordsRead = requests.Count();
model.failedMultiple = requests.Count(t => t.Response == "Failed - Matched Multiple");

model.FailedItemsGrid = SetMUGridProperties();
model.FailedItemsGrid.DataSource = failedRequestsList;

return View(model);

SetMUGridProperties方法设置ifGrid的参数,如下所示:

public GridModel SetMUGridProperties()
        {
            GridModel grdmodel = new GridModel();
            grdmodel.AutoGenerateColumns = false;
            grdmodel.Width = "100%";
            grdmodel.Height = "445px";
            grdmodel.DefaultColumnWidth = "*";
            grdmodel.PrimaryKey = "RequestID";
            grdmodel.ResponseDataKey = "Records";
            grdmodel.RenderCheckboxes = false;
            grdmodel.AutoCommit = false;
            grdmodel.EnableUTCDates = true;
            GridColumn RequestID = new GridColumn();
            RequestID.Key = "RequestID";
            RequestID.HeaderText = "Request ID";
            RequestID.DataType = "number";
            RequestID.Width = "90px";
            GridColumn RTC = new GridColumn();
            RTC.Key = "rtcCode";
            RTC.HeaderText = "RTC";
            RTC.DataType = "string";
            RTC.Width = "85px";
            GridColumn TemplateID = new GridColumn();
            TemplateID.Key = "TemplateID";
            TemplateID.HeaderText = "Template ID";
            TemplateID.DataType = "number";
            TemplateID.Width = "90px";
            GridColumn FCItemDate = new GridColumn();
            FCItemDate.Key = "FCItemDate";
            FCItemDate.HeaderText = "Date";
            FCItemDate.DataType = "date";
            FCItemDate.DateDisplayType = DateDisplayType.UTC;
            FCItemDate.Width = "95px";
            FCItemDate.ColumnCssClass = "borderright";
            GridColumn Amount = new GridColumn();
            Amount.Key = "Amount";
            Amount.HeaderText = "Amount";
            Amount.DataType = "number";
            Amount.Format = "0.00";
            GridColumn AmountTMSUpload = new GridColumn();
            AmountTMSUpload.Key = "AmountTMSUpload";
            AmountTMSUpload.HeaderText = "Amount - TMS Upload";
            AmountTMSUpload.DataType = "number";
            AmountTMSUpload.Format = "0.00";
            GridColumn Response = new GridColumn();
            Response.Key = "Response";
            Response.HeaderText = "Failed Reason";
            Response.DataType = "string";
            grdmodel.Columns.Add(RequestID);
            grdmodel.Columns.Add(RTC);
            grdmodel.Columns.Add(TemplateID);
            grdmodel.Columns.Add(FCItemDate);
            grdmodel.Columns.Add(Amount);
            grdmodel.Columns.Add(AmountTMSUpload);
            grdmodel.Columns.Add(Response);
            GridSorting sorting = new GridSorting();
            sorting.Mode = SortingMode.Single;
            sorting.ColumnSettings = new List<ColumnSortingSetting>() { new ColumnSortingSetting() { ColumnKey = "Response", AllowSorting = false } };
            grdmodel.Features.Add(sorting);
            GridResizing resizing = new GridResizing();
            resizing.AllowDoubleClickToResize = true;
            grdmodel.Features.Add(resizing);
            GridFiltering filtering = new GridFiltering();
            filtering.ColumnSettings = new List<ColumnFilteringSetting>() { new ColumnFilteringSetting() { ColumnKey = "RequestID", AllowFiltering = false } };
            grdmodel.Features.Add(filtering);

            return grdmodel;
        }

最后,这是(大部分)与之相关的页面代码。

@using Infragistics.Web.Mvc
@model GCFF.Web.Models.MassUploadViewModel
@{
    ViewData["Title"] = "Mass Upload";
    Layout = "_Layout";
}

@using (Html.BeginForm("MassUpload", "Forecast", FormMethod.Post, new { @enctype = "multipart/form-data" }))
{
    @Html.AntiForgeryToken()
    ~upload input
    ~submit button
    ~feedback section
    @(Html.Infragistics().Grid(Model.FailedItemsGrid))
}
<script type="text/javascript">

    $(function () {
        var recordsRead = '@Model.recordsRead';

        if (recordsRead == '') {
            $('#uploadresults').hide();
        }
        else {
            $('#recordsRead').text('@Model.recordsRead');
            $('#failedMultiple').text('@Model.failedMultiple');
        }
    });
</script>


1 个答案:

答案 0 :(得分:1)

我们知道了。我已经为此在属性中的网格上启用了过滤功能

            GridFiltering filtering = new GridFiltering();
            filtering.ColumnSettings = new List<ColumnFilteringSetting>() { new ColumnFilteringSetting() { ColumnKey = "RequestID", AllowFiltering = false } };
            grdmodel.Features.Add(filtering);

但是数据源对象不是可查询的格式,因此导致igGrid失败。解决方法是(AsQueryable())

            model.FailedItemsGrid.DataSource = failedRequestsList.AsQueryable();