"class" is a protected keyword, you need to use:
@Html.PropertyFor(x => x.LinkListCollection, new { @class = "no-bullet"})
This is still not working for me :-(
@Html.PropertyFor(x => x.Image, new { @class = "icon-header-icon" })
or
@Html.PropertyFor(x => x.Image, new { CssClass = "icon-header-icon" })
Both do not render an image with class 'icon-header-icon'
(Using Episerver 7.5)
See this blog post:
http://tedgustaf.com/blog/2014/4/render-image-properties-in-episerver-75/
The attributes you can use with html.propertyfor is explained by joel. http://joelabrahamsson.com/episerver-7-and-mvc-custom-tags-and-css-classes-when-rendering-properties/
I sugest you just create a displaytemplate for your property. Either you can use the name of the type or our can use UIHint to render specific templates. If so also make sure you use the PresentationLayer property as well.
[UIHint(UIHint.Image, PresentationLayer.Edit)]
"Passing a custom CSS class only affects those properties for which a HTML element is created when using PropertyFor, such as content areas. In other words, in the below example the CssClass setting won’t actually do anything at all as no element is created when rendering string properties." - Joels blogpost.
I have the same problem with images in EPiServer 7.5. When UIHint is set to "Image", EPiServer correctly renders content references using tag. But CSS class is not applied in any way.
@Eric, CSS class should work for images, because they render tag, not only string. So I would expect CSS classes support in default image rendering.
I am trying to render a block with a link list collection and set a custom CSS class on the <ul> element.
@Html.PropertyFor(x => x.LinkListCollection, new { CssClass = "no-bullet"})
This is renders an ul-list with no class set.