Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Robert 21 posts 122 karma points
    Oct 22, 2016 @ 12:07
    Robert
    0

    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.

  • Ian 178 posts 752 karma points
    Oct 23, 2016 @ 14:45
    Ian
    0

    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

  • Robert 21 posts 122 karma points
    Oct 26, 2016 @ 09:25
    Robert
    0

    Hi, Ian; THank you for your response. After a bit of time googling, I found that using:

     var umbracoHelper = new  Umbraco.Web.UmbracoHelper(Umbraco.Web.UmbracoContext.Current)
    

    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

Please Sign in or register to post replies

Write your reply to:

Draft