之間傳遞,我試圖做到這一點:參數動作
public ActionResult Index(List<Client> Client)
{
if (Client != null)
return View(Client);
return View(db.Client.ToList());
}
[HttpPost]
public ActionResult Search(string cnpj)
{
List<Client> Client = db.Client // here it finds one client
.Where(c => cnpj.Equals(c.Cnpj))
.ToList();
return RedirectToAction("Index", Client);
}
行動搜尋之後,它進入指數,但客戶端參數始終是空..
有人知道這是爲什麼?
我做到這一點,工作原理:
public ActionResult Index(string cnpj)
{
if (!string.IsNullOrEmpty(cnpj))
{
List<Client> clients = db.Client
.Where(c => cnpj.Equals(c.Cnpj))
.ToList();
return View(clients);
}
return View(db.Client.ToList());
}
是否已進行了確認查詢實際上是返回的東西嗎? – JasCav 2012-04-19 16:55:59
是的,我確定。當我調試它時得到一個客戶端。 – MuriloKunze 2012-04-19 17:01:40
我決定,謝謝。 – MuriloKunze 2012-04-19 17:13:47