Hi,
I need to setup cascading Dropdownlists for City and Zipcode in my MVC5 controller. My Action is as follows:
When I build, errors are thrown on the lines 8 and 22 above stating that operator == cannot be applied to operands of type int and System.Linq.IQueryable<FRCV2>. I followed the dropdownlist example in the Kendo demo section, but it appears that I've not cast correct comparisons? Can someone identify what I need to change in the above so that I can properly render these cascading dropdownlists?
I need to setup cascading Dropdownlists for City and Zipcode in my MVC5 controller. My Action is as follows:
01.
public
JsonResult GetZips()
02.
{
03.
FreightEntities freight =
new
FreightEntities();
04.
var zips = freight.ZipCodes.AsQueryable();
05.
var city = freight.ZipCodes.AsQueryable();
06.
if
(city !=
null
)
07.
{
08.
zips = zips.Where(z => z.ZipID == zips);
09.
}
10.
return
Json(freight.ZipCodes.Select(z =>
new
{Zip = z.ZipID, State = z.StateID, City = z.City }), JsonRequestBehavior.AllowGet);
11.
}
12.
13.
14.
15.
public
JsonResult GetCity()
16.
{
17.
FreightEntities freight =
new
FreightEntities();
18.
var state = freight.States.AsQueryable();
19.
var city = freight.ZipCodes.AsQueryable();
20.
if
(state !=
null
)
21.
{
22.
city = city.Where(s => s.StateID == state);
23.
}
24.
return
Json(freight.ZipCodes.Select(s =>
new
{ State = s.StateID, City = s.City }), JsonRequestBehavior.AllowGet);
25.
26.
}
When I build, errors are thrown on the lines 8 and 22 above stating that operator == cannot be applied to operands of type int and System.Linq.IQueryable<FRCV2>. I followed the dropdownlist example in the Kendo demo section, but it appears that I've not cast correct comparisons? Can someone identify what I need to change in the above so that I can properly render these cascading dropdownlists?