C# 从数据库加载MVC4.0帮助程序的Ignite ui组合框错误
我正在尝试使用一个名为combobox的ignite ui组件,并尝试在igniteui页面上遵循本教程 以下是链接: 本教程使用了一个存储库工厂,我正在使用linq的实体框架模型。 我已经使用了ignite ui的一些组件,比如igGrid,我遵循了本视频的教程 使网格与ef模型绑定 我在将数据绑定到combobox时遇到了问题,我试图采用相同的方法来绑定iggrid,但我遇到了一些问题 在我看来,我得到了这个C# 从数据库加载MVC4.0帮助程序的Ignite ui组合框错误,c#,asp.net-mvc-4,entity-framework-5,ignite-ui,C#,Asp.net Mvc 4,Entity Framework 5,Ignite Ui,我正在尝试使用一个名为combobox的ignite ui组件,并尝试在igniteui页面上遵循本教程 以下是链接: 本教程使用了一个存储库工厂,我正在使用linq的实体框架模型。 我已经使用了ignite ui的一些组件,比如igGrid,我遵循了本视频的教程 使网格与ef模型绑定 我在将数据绑定到combobox时遇到了问题,我试图采用相同的方法来绑定iggrid,但我遇到了一些问题 在我看来,我得到了这个 @(Html.Infragistics().ComboFor(item=&g
@(Html.Infragistics().ComboFor(item=>item.IDCliente)
.Width("270px")
.DataSourceUrl(Url.Action("cliente-combo-data"))
.ValueKey("ID")
.TextKey("Name")
.DataBind()
.Render()
)
在控制器中,我有:
[ComboDataSourceAction]
[ActionName("cliente-combo-data")]
public ActionResult ComboData()
{
return View(LicenciamentoMVC.Models.ClienteModel.GetListaClientes());
}
public class ClienteModel
{
private static Cliente entity;
public static IQueryable<Cliente> GetListaClientes()
{
MvcApplication1Context db = new MvcApplication1Context();
var customers = from c in db.Clientes
orderby c.IDCliente descending
where c.Rem==0
select c;
return customers.AsQueryable<Cliente>();
}
在我的客户课程中,我有:
[ComboDataSourceAction]
[ActionName("cliente-combo-data")]
public ActionResult ComboData()
{
return View(LicenciamentoMVC.Models.ClienteModel.GetListaClientes());
}
public class ClienteModel
{
private static Cliente entity;
public static IQueryable<Cliente> GetListaClientes()
{
MvcApplication1Context db = new MvcApplication1Context();
var customers = from c in db.Clientes
orderby c.IDCliente descending
where c.Rem==0
select c;
return customers.AsQueryable<Cliente>();
}
公共类客户模型
{
私有静态客户实体;
公共静态IQueryable getListaClients()的
{
MVCAPApplication1Context db=新的MVCAPApplication1Context();
var客户=来自以db.客户为单位的c
orderby c.IDCliente降序
其中c.Rem==0
选择c;
返回客户。AsQueryable();
}
给我的错误是:
“System.Collections.Generic.IEnumerable”不包含“IDCliente”的定义,并且找不到接受“System.Collections.Generic.IEnumerable”类型的第一个参数的扩展方法“IDCliente”(是否缺少using指令或程序集引用?
我需要做哪些更改,或者最好的方法是使用实体模型而不是go for repository。。。
提前感谢..解决方案是更改我在视图中初始化组合框的方式,我遵循igniteui教程,他们在组合框上的示例对于如何使用组合框的示例/教程来说有点复杂。。。。 下面是mvc和助手的代码
@(Html.Infragistics().Combo().
ID("comboClientes").
TextKey("Nome").
AutoComplete(false).
FilteringType(ComboFilteringType.Local).
RenderMatchItemsCondition(ComboRenderMatchItemsCondition.StartsWith).
ValueKey("IDCliente").DataSourceUrl(Url.Action("clientes-combo")).
DataBind().
Render())
谢谢