Copied to clipboard

Flag this post as spam?

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


  • Abdul Rahim 21 posts 83 karma points
    Sep 23, 2015 @ 07:53
    Abdul Rahim
    0

    Get Content Icon from ICONTENT variable

    Hi guys

    I want to take Icon from Icontent Object. I could take it from Document object. How to get icon through api.

    Thanks

    Rahim

  • Nikola Romcevic 26 posts 139 karma points
    Sep 23, 2015 @ 09:12
    Nikola Romcevic
    102

    Hey!

    This will get you the CSS-class for the icon:

    int nodeId = 1337;
    IContent content = ApplicationContext.Current.Services.ContentService.GetById(nodeId);
    string icon = content.ContentType.Icon;
    

    But it won't show the icon on the front-end unless you are using the same CSS as in the back-end.

    /Nikola

  • Abdul Rahim 21 posts 83 karma points
    Oct 05, 2015 @ 07:34
    Abdul Rahim
    0

    Hi Nikola,

    Its working.. Thanks for your reply.

    Rahim

  • Liam Dilley 172 posts 402 karma points
    Aug 03, 2020 @ 02:05
    Liam Dilley
    0

    How would you get this in Razor. I have tried adding the relvent @using and the above and variations of and not able to get it to work.

Please Sign in or register to post replies

Write your reply to:

Draft