Block Grid - Get block area properties from within...
# help-with-umbraco
a
I need to know the column span (Area property) at the item level. (Because I'm using utility classes). I'm hacking it by using TempData, but this falls down in the back end (using BlockPreview). Does anyone know how to access the Area a block item is in from within a view that is typed thusly:
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<Umbraco.Cms.Core.Models.Blocks.BlockGridItem<elementClass>>
r
@Model.Areas
and
@Model.ColumnSpan
should both be accessible in the partial and have much better support in v1.6.0/1.6.1 of BlockPreview. If there's something specific that's still not working please open an issue and I'll investigate!
d
Hey @rickbutterfield we are in 1.6.1 We have code working in backoffice (e.g.
@Model.ColumnSpan
) and FE but in backoffice the number becomes 0
Should I upgrade to 7?
r
Is the block item nested within an area?
If it is I might have a fix ready to go 😁
d
Yes it is
We have some conditionals based on area which works for FE but in Preview
e.g. Number of items across in a grid based on the number of cols in a grid area
r
I've just this second pushed v1.7.1 to NuGet with a fix for this in it, please give it a go and let me know how you get on!
6 Views