sitecore8 - Sitecore - setting background-image a div to a CMS value -


i've been try add background image of div value sitecore (8.0) in c# mvc using code

<div style="background-image: url({model.myimage.src})> 

where myimage of type image returned glassview

this returning html such as

<div style="background-image: url(/~/media/myfolders/myimage.ashx)"> 

this image isnt being displayed when page rendered- although url resolves when entered browser's address bar must issue .ashx extension background image div.

i tried using sitecore.resources.media.mediamanager.getmediaurl(mediaitem) returned me ashx couldn't resolved!

try background-image: url('@model.image.src'). while example doesn't show it, have spaces in folder or file name, requires single or double quotes.


Comments

Popular posts from this blog

android - net_scheduler holding wakelock -

sql - MySQL : Getting Entries from a many-to-many table -

java - Retrieving data from database using jsp (Hibernate + Spring + Maven) -