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?