快速回顧:我有一個汽車網站,我有一個簡單的ActionResult授權每個用戶有權訪問該控制器將有1輛汽車的寶馬,本田,福特或起亞,所以只要他們登錄,他們就會自動看到汽車的製造。我已經有PartialView設置,但我的問題是我怎麼能從ActionResult調用PartialView並將其放入View中的DIV中?mvc3調用ActionResult中的PartialViews放入DIV內
[Authorize]
public ActionResult Mycars()
{
// How can I return a PartialView here and put it inside a DIV like
// the partialview is called "Mymakes" and its a PartialViewResult
// I just can't seem to put it inside a DIV from here
return View();
}
至於說PartialViewResult作品完美地我把它用Ajax.BeginForm 現在只是想在自動的ActionResult使其任何提示將是巨大的測試!
嗯,不確定明白...從視圖調用partialView:'@ Html.Partial(...)',而不是從控制器。 –
可以控制er行爲將從@ Html.Partial(...)調用,因爲PartialViewResult必須調用數據庫。 – user1949387