I'm trying to pass a ViewData object from a controller that's returning JSON data, but unable to access it from the frontend.
public ActionResult GLSearchView_Read([DataSourceRequest] DataSourceRequest request, DateTime? d = null, DateTime? d2 = null, int aid = 0)
{
bool creditMemo = true
ViewData["creditMemo"] = creditMemo;
var result = Json(GLResearch.Read(aid, d, d2).ToDataSourceResult(request));
result.MaxJsonLength = int.MaxValue;
return result;
}
I'm then supposed to use the value of that boolean from the ViewData object to render something conditionally on the frontend. However, I can't seem to access that ViewData object, am I doing something wrong here?