Try our conversational search powered by Generative AI!

Issues with contentarea and viewdata gets dropped when moving the blocks in the ui

Vote:
 

Hi there iam currently having issues with the viewdata dropping and the AlloyContentAreaRenderer isnt providing with the neccecary classes.

is there anyone else that had this issue?

protected override string GetContentAreaItemCssClass(HtmlHelper htmlHelper, ContentAreaItem contentAreaItem)
{
var baseItemCssClass = base.GetContentAreaItemCssClass(htmlHelper, contentAreaItem);
var tag = GetContentAreaItemTemplateTag(htmlHelper, contentAreaItem);

return string.Format("{0} {1} {2} {3}", GetTypeSpecificCssClasses(contentAreaItem), GetCssClassForTag(tag), tag, baseItemCssClass);
}

 

the first load i get span4 on the block and its container gets row-fluid

second request(when iam moving the block within the content area) the classes will be empty

#151861
Aug 09, 2016 10:05
Vote:
 

You will get an empty string if you've set the block to automatic but other than that the correct size should come through if you've set wide, narrow or full. We are using this in EPiServer 9 without issues

#151871
Aug 09, 2016 13:05
Vote:
 

yeah currently using episerver 9 thou upgraded from 7, and i booted up the alloy site and the samething works fine there, i dont know if its because they use the tag system to build upp diffrent classes.

this is how i render the contentarea

   

 @Html.PropertyFor(x => x.ContentArea, new { CssClass = "row-fluid", ChildrenCssClass = "span4" })

CssClass is what the wrapper will have and the ChildrenCssClass is what each block(contentareaitem) will have.

so iam not using the DiplayOption that most user use. maybe thats why the viewdata becomes empty since there is no refrence beside the view, and when you move with episerver there is a ajax request for updating the view, so then i wont be able to find the view data provided  with the ChildrenCssClass...

#151876
Aug 09, 2016 14:12
Vote:
 

well i found the issue, the issue was that the contentarea was renderd in a custom way and by that you have to add 

@Html.FullRefreshPropertiesMetaData(new [] { "<PropertyName>"})

to force episerver to do a full refresh of the page when the block are moved, was looking on the wrong property.

thanks for your efforts to help me =)

\\Mårten

#151899
Edited, Aug 10, 2016 7:54
Vote:
 

Ah yes you need that to refresh, although I personally prefer rendering 

@Html.FullRefreshPropertiesMetaData()

On your master page and then connecting the properties that need refresh in your controllers. As defined here http://world.episerver.com/documentation/Items/Developers-Guide/EPiServer-CMS/7/Content/Pages-and-Blocks/How-To/Edit-hints-in-MVC/

var editingHints = ViewData.GetEditHints<EditSampleViewModel, EditSamplePage>();

editingHints.AddFullRefreshFor(p => p.ShowBanner);
#151906
Edited, Aug 10, 2016 9:35
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.