MVC在强类型视图中创建inffragistics网格



我有一个视图(ViewLeads),只有一个inffragistics网格已经工作和拉数据很好。我有另一个视图(UpdateLead),我有几个文本框,其中显示网格中的数据,当你点击一个特定的用户。

我想做的是将inffragistics网格添加到这个新视图(UpdateLead)。我遇到的问题是,在我的第一个视图(ViewLead)我的模型参考是…

@model IQueryable<LeadManagement.BusinessEntities.BusinessLead>

再往下是我的网格,比如。

 @(Html.Infragistics()
            .Grid(Model)
            .ID("grid123")
            .Width("100%")
            .PrimaryKey("Lead_ID")
            .AutoGenerateColumns(false)
            .AutoGenerateLayouts(false)
            .Columns(column =>
            {

                column.For(x => x.Lead_ID).Hidden(true);
                onclick='return true;' />", "Lead_ID", "string", "3%") { Template = "<input type='checkbox' name='select'/>" });
               style='color:blue;'>${Name}</a>").HeaderText("Name").Width("10%");
                style='color:blue;'>${Name}</a>").HeaderText("Name").Width("10%");
                column.For(x => x.Name).Template("<a href='UpdateLead?id=${Lead_ID}' style='color:blue;'>${Name}</a>").HeaderText("Name").Width("10%");
                column.For(x => x.LeadCreationDate).HeaderText("Created").Width("8%");
                column.For(x => x.Source).HeaderText("Source").Width("10%");
                column.For(x => x.status).Template("<a href='#' style='color:blue;'>${status}</a>").HeaderText("Status").Width("10%");
                column.For(x => x.Note).HeaderText("Notes").Width("10%"); 
                column.For(x => x.Litigation).HeaderText("Type of Litigation").Width("12%");
                column.For(x => x.originalFirm).HeaderText("Original Firm").Width("13%");
                column.For(x => x.CurrentFirm).HeaderText("Current Firm").Width("13%");
                column.Columns.Add(new GridColumn("Accept/Deny/Transfer", "Lead_ID", "string", "18%") { Template = "<input type='image' src='/Images/Accept.jpg' height='20' width='20' onclick='return Accepted(${Lead_ID})'/>&nbsp;&nbsp;&nbsp;<input type='image' src='/Images/Reject.png' height='20' width='20' onclick='return Rejected(${Lead_ID})'/>&nbsp;&nbsp;&nbsp;<input type='image' src='/Images/Transfer.png' height='20' width='20' id='InputAssignLead' onclick='return AssignLead(${Lead_ID})'/>" });
            })

现在…

在我的另一个视图(UpdateLead),因为我有文本框和东西,我填充我的模型参考是…

@model LeadManagement.BusinessEntities.BusinessLead

所以当我试图将网格代码复制到这个视图时,它会报错

.Grid(Model)

部分,说它有无效的参数,反之亦然,如果我将模型引用更改为一个可查询的引用,文本框会报错。

我怎么能有两个在同一页(文本框和网格)????我试过引用两种模型类型,但这也不起作用。这事我已经纠结了好几天了。提前感谢!!

如果没有说明,可能会出现这样的问题:

@using Infragistics.Web.Mvc

和你的模型,就像下面的例子

@using IgniteUI.SamplesBrowser.Models
    @model IQueryable<IgniteUI.SamplesBrowser.Models.Northwind.Product>
<!DOCTYPE html>
<html>
<head>
    <title></title>
    <!-- Ignite UI Required Combined CSS Files -->
    <link href="http://cdn-na.infragistics.com/igniteui/2016.2/latest/css/themes/infragistics/infragistics.theme.css" rel="stylesheet" />
    <link href="http://cdn-na.infragistics.com/igniteui/2016.2/latest/css/structure/infragistics.css" rel="stylesheet" />
    <script src="http://ajax.aspnetcdn.com/ajax/modernizr/modernizr-2.8.3.js"></script>
    <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
    <script src="http://code.jquery.com/ui/1.11.1/jquery-ui.min.js"></script>
    <!-- Ignite UI Required Combined JavaScript Files -->
    <script src="http://cdn-na.infragistics.com/igniteui/2016.2/latest/js/infragistics.core.js"></script>
    <script src="http://cdn-na.infragistics.com/igniteui/2016.2/latest/js/infragistics.lob.js"></script>
</head>
<body>
        @(Html.Infragistics()
            .Grid(Model)
            .ID("grid")
            .Width("100%")
            .Height("500px")
            .PrimaryKey("ID")
            .AutoGenerateColumns(false)
            .AutoGenerateLayouts(false)
            .Columns(column =>
            {
                column.For(x => x.ProductName).HeaderText("Product Name").Width("30%");
                column.For(x => x.CategoryName).HeaderText("Category").Width("30%");
                column.For(x => x.UnitPrice).HeaderText("Unit Price").Width("20%");
                column.For(x => x.UnitsInStock).HeaderText("Units In Stock").Width("20%");
            })
            .Features(features =>
            {
                features.Sorting().Type(OpType.Remote);
                features.Paging().Type(OpType.Remote);
                features.Filtering().Type(OpType.Remote);
                features.Responsive().ColumnSettings(cs =>
                {
                    cs.ColumnSetting().ColumnKey("CategoryName").Classes("ui-hidden-phone");
                    cs.ColumnSetting().ColumnKey("UnitPrice").Classes("ui-hidden-phone ui-hidden-tablet");
                });
            })
            .DataSourceUrl(Url.Action("GetProducts"))
            .Render()
        )
    </body>
    </html>
http://www.igniteui.com/grid/_ga=1.235256967.729368916.1477415519

相关内容

  • 没有找到相关文章

最新更新