I'm wondering if anybody is able to help with the easiest way to access the Model of the page which holds the grid within the view (or Grid Value Converter) for the Editor?
When using this line of code, you will however make the assumption that the requested page is also the one holding the grid value - which may not always be the case.
I'd like to make this easier in a future release, and have already made some of the work:
This means that you'll be able to acces the parent IPublishedElement of the page or element holding the grid value. I don't really have a plan for when this will be released, but hopefully soon ;)
Getting Model for containing page
Hi,
I'm wondering if anybody is able to help with the easiest way to access the Model of the page which holds the grid within the view (or Grid Value Converter) for the Editor?
Thanks Andy
Hi Andy,
There is currently no way this package lets you get the
IPublishedContent
holding the grid value. So currently the best option is:When using this line of code, you will however make the assumption that the requested page is also the one holding the grid value - which may not always be the case.
I'd like to make this easier in a future release, and have already made some of the work:
https://github.com/skybrud/Skybrud.Umbraco.GridData/blob/dev/interfaces/src/Skybrud.Umbraco.GridData/Models/GridDataModel.cs#L39
This means that you'll be able to acces the parent
IPublishedElement
of the page or element holding the grid value. I don't really have a plan for when this will be released, but hopefully soon ;)Hi Anders,
Thanks for the code works OK for what I'm doing.
The change you're looking at making would be really useful.
Thanks Andy
is working on a reply...