Hi,
Have you tried these solutions-
https://world.episerver.com/documentation/developer-guides/CMS/Content/Edit-hints-in-MVC/
Jerzy,
Do you want to refresh the preview mode or are you inside the On-Page Edit?
Bartek
Could you just have a basic service do the page update and just return what it changed and handle it with javascript on the success post?
Rather than posting back the view model, it just returns a really simple json object, myobject {selectedItem:"product1", domID="p1"} then you do your logic client side in the success response. To the user it will look like the page refreshed in the interim.
Btw. why don't you use our helper
@Html.PropertyFor(modelItem => Model.CurrentPage.SelectionBox)
You don't need to do stuff like you wrote, saving property values is done by EPiServer.
An exact example is written here: https://world.episerver.com/documentation/developer-guides/CMS/Content/Edit-hints-in-MVC/
Look for 'ShowBanner' property
Let's say I have a property on the page:
An then in the view, I have this code:
Controller method is very simple:
Basically what it does, it takes the value of the checkbox, does a AJAX call to the controller, which then updates the page property with value. And this works fine. What I'm struggling with, is how to refresh the page in preview after the succesful save in the controller.
I have tried subscribing to contentSaved event, but it's not called.
Essentially I'm looking for a way to either:
In my use case, editor will be pointing to a collection (coming from external system), and it will render list of items in that collection. Then user would be able to pick which items from that collection to show or hide. I'd like to maintain the list of exclusions as a property, which I anticipate I could update via AJAX calls.
If there are better options - I'm open for those as well.