As I understand problem is that Umbraco doesn't know on which page you are.
Model.Content - it's CurrentPage, but when you get '/Umbraco/Surface/ProductsSurface/partialProducts' url via ajax Umbraco doesn't know what is CurrentPage.
You have to help Umbraco to understand what page exactly you want to retrieve.
IPublishedContent in a Partial View
Hi guys, I´m trying to use IPublishedContent in a partial view and I´m having some problems. Here´s the code:
I got one page that calls a partial view using ajax, the ajax call it´s working fine, I will just show the controller and the partial view code.
Controller
Partial View
pageName it´s returning me Null, but I test a normal view and the code works fine, does anyone knows how to solve this problem.
Best Regards
Hi Vanilson,
The problem with a context in ajax call.
Are you using SurfaceController or just mvc controller?
Thanks,
Alex
Hi Alex, I´m using Surface Controller, here is the code of the ajax:
Best Regards
Hi Vanilson,
As I understand problem is that Umbraco doesn't know on which page you are. Model.Content - it's CurrentPage, but when you get '/Umbraco/Surface/ProductsSurface/partialProducts' url via ajax Umbraco doesn't know what is CurrentPage. You have to help Umbraco to understand what page exactly you want to retrieve.
Happy coding,
Alex
Hi Alex, I guess that you´re right. I change the view that must call the partial view to this:
And the @pageName give me the value of page that call the partial and not the value of the partial view.
I´m insist on it because I pretend to get some values using IPublishedContent.
Best Regards
Vanilson, you can get your page by id and use it in partial view and even call via ajax.
Was your problem solved?
Best
Hi Alex, solve the problem using UmbracoHelper. Thank you for your help.
Best Regards
Great, can you mark solution solved?
Thanks
is working on a reply...