1
我想根據所選國家/地區綁定2個下拉菜單City
和Currency
。所以我使用了Json並通過了選定的countryId,並在控制器中寫下相應的貨幣和城市值。但問題是,我如何在json中傳遞2個值作爲返回類型?如何從json傳遞2個對象作爲返回
下面是代碼:
[HttpPost]
public ActionResult BindCityAndCurrency(int CountryID)
{
var q = from r in db.Cities where r.CountryID == CountryID orderby r.CityID, r.CityName select r;
var City = q.ToList().Select(c => new { Text = c.CityName, Value = c.CityID });
var Currency = from items in db.Currencies where items.CountryID == CountryID orderby items.CurrencyName, items.CurrencyName select items;
return Json(City,Currency);//here is the error showing Invalid Arguments I
}
感謝alot.Its工作。 – user2090114 2013-03-01 09:56:32
+1給你:),歡迎 – 2013-03-01 09:57:06