我有一个视图(ViewLeads)只有一个Infragistics网格已经工作并且数据正常。我有另一个视图(UpdateLead),其中有几个文本框,当您单击特定用户时,它会显示网格中的数据。
我想要做的是将infragistics网格添加到这个新视图(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})'/> <input type='image' src='/Images/Reject.png' height='20' width='20' onclick='return Rejected(${Lead_ID})'/> <input type='image' src='/Images/Transfer.png' height='20' width='20' id='InputAssignLead' onclick='return AssignLead(${Lead_ID})'/>" });
})
现在...
在我的另一个View(UpdateLead)上,因为我有文本框和我填充模型引用的东西是..
@model LeadManagement.BusinessEntities.BusinessLead
所以当我尝试将我的网格代码复制到此视图时,它会抱怨
.Grid(Model)
部分,说它有无效的参数,如果我改变模型参考文本框抱怨的Iqueryable引用,则反之亦然。
如何在同一页面(文本框和网格)上同时拥有两个?我试过引用两种模型类型,但这也不起作用。我已经被困在这几天了。在此先感谢!!
答案 0 :(得分:1)
当你没有提到时,可能会出现这样的问题:
@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