I'm trying to get a nested content collection in a partial with an ajax call like this (the call works fine, ignore the success I haven't reached that point yet):
namespace MyNameSpace.Web.Controllers.Surface
{
public class CurtainsModuleSurfaceController : BaseSurfaceController
{
[HttpPost]
public JsonResult GetFabrics(int data)
{
var page = Umbraco.TypedContent(data);//this returns the id correctly
var fabricsCollection = page.GetPropertyValue<IEnumerable<IPublishedContent>>("fabricsCollection"); //fabrics collection returns null
return Json(fabricsCollection);
}
}
}
The main view is rendered like this:
@foreach (var item in Model.GetPropertyValue<IEnumerable<IPublishedContent>>("generalContentCollection"))
{
var partialViewName = "_" + item.DocumentTypeAlias;
if (partialViewName == "_curtainsModule")
{
Html.RenderPartial("CurtainsModule", new CurtainsModuleModel(Model, item));
}
else
{
@Html.Partial(partialViewName, item);
}
}
So, basically the fabricsCollection is a nested content collection deep inside another nested content collection. However, when I try to get it from the page (the controller is the problem here) it returns null. I'm not sure why, would someone be able to help?
Nested Content in an ajax call
Hello,
I'm trying to get a nested content collection in a partial with an ajax call like this (the call works fine, ignore the success I haven't reached that point yet):
The controller(here's where the problem lies):
The main view is rendered like this:
So, basically the fabricsCollection is a nested content collection deep inside another nested content collection. However, when I try to get it from the page (the controller is the problem here) it returns null. I'm not sure why, would someone be able to help?
Thanks in advance, Harry
I'm kind of running out of time and can't get a solution. If anyone could help even a little bit I'd really appreciate it.
is working on a reply...