Copied to clipboard

Flag this post as spam?

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


  • Nicolai 48 posts 201 karma points
    Mar 27, 2015 @ 15:26
    Nicolai
    0

    Converting from Scripting File to Partial View Macro File. Part 2

    Im not sure how im going to add an Umbraco.Media image inside a style element, like this:

    <div class="content" style="background-image:url('@Umbraco.Media(page.panelAbmntBoxImage).Url');">
    

    Normally I would have done the fallowing:

    var panelAbmntImage = Umbraco.Media(page.panelAbmntBoxImage);
    <img src="@magazineImage.umbracoFile" />
    

    But I cant use this approach cause its inside a style component.. Can anyone explain or tell me how it can be done?

    Thanks!

    -Nicolai

  • Alex Skrypnyk 6175 posts 24186 karma points MVP 8x admin c-trib
    Mar 28, 2015 @ 16:23
    Alex Skrypnyk
    0

    Privet Nikolai,

    If your images is in the media section of Umbraco, and you have to add css background property to the html, you can only use :

    <div class="content" style="background-image:url('@Umbraco.Media(page.panelAbmntBoxImage).Url');">
    

    I don't like such approach too, but it's better than insert row in the css, create class in the css and than add this class to the html ))

    Thanks

Please Sign in or register to post replies

Write your reply to:

Draft