I have tried to get full refresh to work with MVC and razor the way episerver suggests but so far no luck. I will write below what I did and also what workaround I used to get it to work.
I have a boolean property on one of my blocks that adds a border. What I wanted to achieve was to make a preview page for the block that updated the visuals of the block when the value of that Boolean changed. This required a page refresh then the property changed. I tried following this example in the episerver sdk http://sdkbeta.episerver.com/SDK-html-Container/?path=/SdkDocuments/CMS/7/Knowledge%20Base/Developer%20Guide/Content/Pages%20and%20Blocks/How%20To/Edit%20hints%20in%20MVC.htm&vppRoot=/SdkDocuments//CMS/7/Knowledge%20Base/Developer%20Guide/ .
This is what I did. In the controller I added AddFullRefreshFor for the border Boolean.
var editingHints = ViewData.GetEditHints<ViewModel,EpiBlock>();
In the view I added the full refresh method and the property.
This did not work.It looks like there is a bug in the FullRefreshPropertiesMetaData method.
public static MvcHtmlString FullRefreshPropertiesMetaData<TModel>(this HtmlHelper<TModel> helper)
if (RequestContextExtension.GetContextMode(helper.ViewContext.RequestContext) == ContextMode.Edit)
IList<EditHint> list = helper.ViewData[ViewDataKeys.FullRefreshProperties] as IList<EditHint>;
if (list != null && list.Count > 0)
return PropertyExtensions.FullRefreshPropertiesMetaData((HtmlHelper) helper, Enumerable.ToArray<string>(Enumerable.Select<EditHint, string>((IEnumerable<EditHint>) list, (Func<EditHint, string>) (e => e.ContentDataPropertyName))));
The helper.viewdata returns a list of strings that can't be cast to a IList<EditHint> and thus it will always be null.
The solution that I did was to write my own extension method that solves this.
public static MvcHtmlString FullRefreshPropertiesMetaDataThatActuallyWorks<TViewModel>(this HtmlHelper<TViewModel> me)
var refreshProperties = me.ViewData[ViewDataKeys.FullRefreshProperties] as IEnumerable<string>;
if(refreshProperties != null)
And call this method in the view instead.
That sure looks like a bug. I'll add it to our bug tracker.
Thanks for reporting this, and also for providing a work around.
Update:Bug registered as: #95628: Not possible to add full refresh using the FullRefreshPropertiesMetaData extension method
Per GunsarfsEPiServer Development Team