Hi, there;
I created a doc type that has a grid. Then I added some images to the grid when setting the content.
I would like to use contentService(Or any API) to get these images infor (href, alt, caption...) in my own RenderMvcController and then return my own model to my typed view.
Can someone give any clue or share some codes please?
Hi Robert as you probably already know grid data is stored as json, so in terms of accessing information within the grid you have the option as applied in the grid renderer of parsing the json with jobject jproperty etc, but its not nice. When i wanted more typed access to the grid i dont think that umbracos models builder was as compatible with the grid so i used the skybrud grid data package. That did require an extra level of work as i had to create my own renderers for some grid editors so i could use a strictly typed model. This was made more difficult for some editor types like leblender.
With much greater adoption of models builder if i was you i would concentrate my research on the use of the grid with models builder rather than the two options above. I have not had the opportunity to use models builder in my projects however i would offer this link to you which may be of use. http://web-matters.blogspot.co.uk/2014/11/using-umbraco-mapper-with-umbraco-grids.html?m=1
ContentService+grid
Hi, there; I created a doc type that has a grid. Then I added some images to the grid when setting the content. I would like to use contentService(Or any API) to get these images infor (href, alt, caption...) in my own RenderMvcController and then return my own model to my typed view. Can someone give any clue or share some codes please?
THX!
Robert.
Hi Robert as you probably already know grid data is stored as json, so in terms of accessing information within the grid you have the option as applied in the grid renderer of parsing the json with jobject jproperty etc, but its not nice. When i wanted more typed access to the grid i dont think that umbracos models builder was as compatible with the grid so i used the skybrud grid data package. That did require an extra level of work as i had to create my own renderers for some grid editors so i could use a strictly typed model. This was made more difficult for some editor types like leblender.
With much greater adoption of models builder if i was you i would concentrate my research on the use of the grid with models builder rather than the two options above. I have not had the opportunity to use models builder in my projects however i would offer this link to you which may be of use. http://web-matters.blogspot.co.uk/2014/11/using-umbraco-mapper-with-umbraco-grids.html?m=1
Good luck all the best
Hi, Ian; THank you for your response. After a bit of time googling, I found that using:
in my partial view can get my content. Also the good thing is that my partial view doesn't need to bind any model.
Cheers Robert
is working on a reply...