Change doesn't show on page edit.


I got an image property with UIHint.Image. The get checks if the property is empty or null.
If it is empty it gets a default image or else it takes the image i have choosen for the page.

to be able to make a change on onpage edit i have the @Html.EditAttributes(x => x.CurrentPage.Image).

I can see the frame for the image property and click on it. Here i can choose another image or make i
blank to get the default image.
When i do a change i should be able to see the image i have choosen or the default image.
But it doesnt load the new image.
What i need to do is the click on the preview button or reload the page to see the image i have
changed too.
I dont know what the problem is at the moment?


Apr 14, 2014 15:49

Try adding the @Html.FullPageRefresh() to the view to force a refresh (you need to pass in the property names in the method). This is from memory so the method name might me slightly different.


Apr 14, 2014 16:06

Fredrik is right, do a FullPageRefresh() and it will work.
You can get it to work even wiithout it but then you have to take in count that when EPiServer calls the displaytemplate after you have loaded a image but before you done a fullpage refresh it does not pass in the same thing. It passes in a json-string with information of contentid and so on.
I can show you in code tomorrow (does not have the code here) how we do that for one of our displaytemplates

Apr 14, 2014 21:18

We have a customproperty that inherit from xhtml and using it's own type of inheritance so not to confuse I have removed all that logic from the example.

First in our displaytemplate we call a extensionmethod to do the logic:

    var htmlValue = @HtmlHelpers.GetInheritXhtmlValue(@ViewData["propertyName"].ToString(), (object)@ViewData["CurrentPage"], Model);



Then the extension method looks like this:

public static object GetInheritXhtmlValue(string propertyName, object currentPageOrRef, string propertyValue)
            PageData currentPage = null;

            if (currentPageOrRef == null)
                return string.Empty;

            if (currentPageOrRef is PageData)
               // return PageData-value, ie: the main load of page
                //It is a on page edit update of page, then there is a json formated link to the page
                var json = Json.Decode(currentPageOrRef.ToString());
                if (json.contentLink != null)
                    currentPage = ServiceLocator.Current.GetInstance<IContentRepository>().Get<EducationLocationPage>(new ContentReference(json.contentLink));
                    return GetParentPropertyValue(propertyName, currentPage);

            return string.Empty;


Hope this will help someone

Apr 15, 2014 8:04

Thanks for the answers Fredrik and Henrik. I havent had the time to try out the FullPageRefresh yet. But it surley will atleast please the customer. 

Apr 15, 2014 16:15
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.