Hello everyone,
i'm need to return list to client side using viewbag and return view
let's see code :
Server Side :
var model = _iSiteService.FindProduct(id);
var UnitsData = _iSiteService.GetAllProductsUnits(id).Where(x => x.Product.IsActive).Select(i => new
{
i.Id,
i.UnitId,
i.ConversionFactor,
i.ProductId
}).ToArray();
ViewBag.dataUnitsXX = Json(new
{
Data = UnitsData.ToArray()
}, JsonRequestBehavior.AllowGet);
return View(model);
Client Side :
var json = @Html.Raw(ViewBag.dataUnitsXX);
Message Error :
var json = System.Collections.Generic.List`1[<>f__AnonymousType2`4[System.Int32,System.Int32,System.Decimal,System.Int32]];
How i can solved it.
please help me to return data in variable in javascript Thanks You.