i am trying to use a ignite ui componet called combobox , and i was trying to follow this tutorial on the igniteui page.
heres is the link:<http://www.igniteui.com/combo/aspnet-mvc-helper>
the tutorial uses a repository factory, and i am using entity framework model with linq.i already use some of the components of ignite ui, like igGrid, and i followed the tutorial on this video
<http://es.infragistics.com/products/jquery/grid/videos/iggrid-entity-framework-model> to make the grid bind with ef model.
I am having problems with the binding of the data to the combobox,i wqas trying to follow the same approach to the bing of iggrid, but i am having some problems..
in my view i have got this..
@(Html.Infragistics().ComboFor(item=>item.IDCliente) .Width("270px") .DataSourceUrl(Url.Action("employee-combo-data")) .ValueKey("ID") .TextKey("Name") .DataBind() .Render() )
in the controller i have this:
[ComboDataSourceAction] [ActionName("cliente-combo-data")] public ActionResult ComboData() { return View(LicenciamentoMVC.Models.ClienteModel.GetListaClientes()); }
and in my cliente class i have this:
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>(); }the **error** that is giving me is:**System.Collections.Generic.IEnumerable<'LicenciamentoMVC.Models.Cliente'> does not contain any definition for 'IDCliente'.**
What changes do i need to do, or the best way to go is instead of using entity model go for repository...thanks in advance..
Hi, Hugo.
What I can see at first glance, is that maybe your solution is missing some reference, like it's said in this forum post, or the query is not returning IDClinte for some reason. If this is not the case then it will be great to share some more information for the repository you are using or to attach the problematic sample. I'm not sure what kind of repository you are going to use, but what you need to do at the end is to convert the result from the repository to IQueryable using the AsQueryable method.
Thank you for using our product and I will wait for your feedback.
Best regards,
Nikolay Alipiev
I am following up to see if you were able to resolve your case and if you need more help. Don't hesitate to ask if you have more questions.
Nikolay
i manage to solve the problem, it was a problem on my behalf, the example that i was following was a bit different that i was trying to achieve...
view
@(Html.Infragistics().Combo(). ID("comboClientes"). TextKey("Nome"). AutoComplete(false). FilteringType(ComboFilteringType.Local). RenderMatchItemsCondition(ComboRenderMatchItemsCondition.StartsWith). ValueKey("IDCliente"). DataSourceUrl(Url.Action("clientes-combo-data")). DataBind(). Render())
Controller
public ActionResult ComboDataClientes() { //obter todos os clientes do tipo revendedor... //string[] arrTipoCliente = { "Revendedor", "Distribuidor" }; //return View(Licenciamento_v2.Areas.Idonic.Models.Cliente.GetListClienteByTipo(arrTipoCliente)); return View(Licenciamento_v2.Areas.Idonic.Models.Cliente.GetListaClientes());
}
Class
public static IQueryable<Cliente> GetListaClientes() { MvcIdonic db = new MvcIdonic(); var customers = from c in db.Clientes orderby c.IDCliente descending where c.Rem==0 select c; return customers.AsQueryable<Cliente>(); }
i am having a new problem, load the data from the database...it was working fine until yesterday, i was doing some test and i could set the client using the combo box..it is saying no results..
wich is strange because using breakpoint i can see that the method is being called, and with firebug or chrome console i can see that it is returning the correct data...
What could be wrong...
One of the reasons, when having the data on the client and in the same time not having data in the Combo, could be in the MVC wrapper configuration. I'm sure you are familiar with it, but you need to bind the ValueKey and TextKey of the Combo with the corresponding data source fields - in your sample, you can try to set the ValueKey with the corresponding data source field. The other thing that I've noticed is that your TextKey is "Nome" instead of "Name". Is it possible this to be the case or you gave that name on purpose?
For any further questions, don't hesitate to ask.
I am following up again, to see if you were able to resolve your case. Don't hesitate to ask if you have further questions.