RenderAction ViewBag Empty on the View

时间:2015-07-28 17:00:07

标签: asp.net-mvc

I am invoking a RenderAction from a View as shown below:

@{ Html.RenderAction("GetOptions", "Product", new {ProductId = Model.ProductId});

   var options = ViewBag.Options; 

}

Inside the GetOptions I populate the ViewBag as shown below:

public ActionResult GetOptions(..) {

     // do some other stuff 
     ViewBag.Options = new JavaScriptSerializer().Serializer(options); 

     return Content(somelongstring); 
}

But when I debug inside the var options is always null. What am I doing wrong?

0 个答案:

没有答案
相关问题