[
{
"label": "Set a background image",
"description": "Set a row background",
"key": "background-image",
"view": "imagepicker",
"modifier": "url({0})"
}
]
Both properties work fine so i can pick a style class for row and set a background image.
The issue is in my ContentGrid.cshtml file I have:
public static MvcHtmlString RenderElementAttributes(dynamic contentItem)
{
var attrs = new List<string>();
JObject cfg = contentItem.config;
if(cfg != null)
foreach (JProperty property in cfg.Properties()) {
attrs.Add(property.Name + "='" + property.Value.ToString() + "'");
}
JObject style = contentItem.styles;
if (style != null) {
var cssVals = new List<string>();
foreach (JProperty property in style.Properties())
cssVals.Add(property.Name + ":" + property.Value.ToString() + ";");
if (cssVals.Any())
attrs.Add("style='" + string.Join(" ", cssVals) + "'");
}
return new MvcHtmlString(string.Join(" ", attrs));
}
Issue is i do not see my background image property on the config object. Am I missing something? I need to get this background image that has been set.
It is all out of the box. Only tested on the row, the class works fine but background image is not present in the config. However in content section it is definately saved.
Grid background image on row
Hello,
I have setup two properties in settings for my grid namely:
Settings
Class
Styles Background image
The class one has json config looks like:
For the styles one i have:
Both properties work fine so i can pick a style class for row and set a background image.
The issue is in my ContentGrid.cshtml file I have:
Issue is i do not see my background image property on the config object. Am I missing something? I need to get this background image that has been set.
Regards
Ismail
That's all just straight out of the box stuff right? It looks correct to me!
Do you get the same whether applied to the cell or the row?
David,
It is all out of the box. Only tested on the row, the class works fine but background image is not present in the config. However in content section it is definately saved.
Regards
Ismail
I'd suggest it could be the hyphen in the background-image, but I'm sure that would have been reported as a bug.
David,
It's an epic fail on my part. This is multilingual site and i was setting in once place but viewing somewhere else GRRRRR.
My bad.
Regards
Ismail
It's good to know that this happens to other people to.
is working on a reply...