我有一个部分视图的mvc视图.控制器中有一个ActionResult方法将返回一个PartialView.所以,我需要将ViewBag数据从ActionResult方法传递给部分视图.
@H_502_2@这是我的控制器
我认为我是错误的方法.请指导我
public class PropertyController : BaseController { public ActionResult Index() { return View(); } public ActionResult Step1() { ViewBag.Hello = "Hello"; return PartialView(); } }@H_502_2@在Index.cshtml视图中
@Html.Partial("Step1")@H_502_2@Step1.cshtml部分视图
@ViewBag.Hello@H_502_2@但这不行.那么,从viewbag获取数据的正确方法是什么?
我认为我是错误的方法.请指导我