Asp.net mvc 3 EF HTML MultiSelect - How to retrieve multiple values using LINQ?

Instead of s. IdState == model. IdState try using model.IdState.

Contains(s. IdState).

Thanks, I could compile with model.IdState. Contains((int)s. IdState but I'm getting Unable to create a constant value of type 'System.Collections.Generic.

IEnumerable`1'. Only primitive types ('such as Int32, String, and Guid') are supported in this context, On results. ToPagedList(pageIndex-1, pageSize); Because I'm using PagedList extension (I omitted to clarify) – Santiago May 28 at 23:08 Seems that I can only do simple comparations – Santiago May 28 at 23:27 Are you using .

NET 4.0? Contains doesn't work in EFv1 - . NET 3.5.Also why do you convert s.

IdState to int? Your model. IdState should be already correctly typed when you pass them to the query.

You can also try to store model. IdState in a local variable and pass the local variable to the query instead of model.IdState. – Ladislav Mrnka May 29 at 8:25 Thanks again!

I'm using . NET 4.0 with Razor. I didn't convert to s.

IdState to int. The model is a "SearchResult" model to obtain the Form Data Results from the web. The IdState was the value from a DropDownList and now is a multiple value from a Multiple ListBox.

I'm going to publish a workaround. – Santiago May 29 at 14:43 Contains is translated to SQL IN statement - it is what you want. Just make sure that you pass local array of ints or IEnumerable to your query where you call something like .

Where(e => states. Contains(e.Id)). It should work.

– Ladislav Mrnka May 29 at 14:46.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions