Try our conversational search powered by Generative AI!

ChildrenCssClass not working

Vote:
 

Hi

I'm just wondering if there is a reason why the value I'm setting in ChildrenCssClass isn't being rendered. We're using version 7.10

@Html.PropertyFor(m => m.CurrentPage.ButtonArea, new { CssClass = "row buttons", ChildrenCustomTagName = "div", ChildrenCssClass = "small-12 medium-6 xlarge-3 columns" })

Rather than seeing this:

I see this

Cheers

Jonathan.

#111993
Oct 22, 2014 1:12
Vote:
 

I'm guessing you are using the "AlloyContentAreaRenderer". This override "GetContentAreaItemCssClass".

Alloy version:

        protected override string GetContentAreaItemCssClass(HtmlHelper htmlHelper, ContentAreaItem contentAreaItem)
        {
            var tag = GetContentAreaItemTemplateTag(htmlHelper, contentAreaItem);
            return string.Format("block {0} {1} {2}", GetTypeSpecificCssClasses(contentAreaItem, ContentRepository), GetCssClassForTag(tag), tag);
        }

Base version:

    protected virtual string GetContentAreaItemCssClass(HtmlHelper htmlHelper, ContentAreaItem contentAreaItem)
    {
      return htmlHelper.ViewContext.ViewData["childrencssclass"] as string;
    }

As you can see, the alloy version does not use the childrencssclass. You can add it though, like so (not tested):

            return string.Format("block {0} {1} {2} {3}", GetTypeSpecificCssClasses(contentAreaItem, ContentRepository), GetCssClassForTag(tag), tag, htmlHelper.ViewContext.ViewData["childrencssclass"] as string);
#111997
Oct 22, 2014 9:07
Vote:
 

I agree to Per Magnes solution.

I works as expected

#112002
Oct 22, 2014 9:53
Vote:
 

Thank you, that was the issue.

#112119
Oct 23, 2014 0:11
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.