Harugawa
Harugawa

Reputation: 539

Eval in the div's background url

I managed to eval link here

<div class="img-wrap" style='<%# "background: url('" + Eval("post_image") + "')  no-repeat; background-size:cover;" %>'>

But... I need yet direction to directory.. something like that

<div class="img-wrap" style='<%# "background: url('../images/" + Eval("post_image") + "')  no-repeat; background-size:cover;" %>'>

The problem is that it results with this kind of thing when I check it in browser

<div class="img-wrap" style="background: url(" ..="" images="" image-thumb.jpg')=""  no-repeat;=""   background-size:cover;'="">

It creates a spaces between and doesn't target to anything

@edit:

Here the img for better visualisation

image

Upvotes: 0

Views: 1144

Answers (1)

Sam
Sam

Reputation: 2917

Try this

style='<%# "background-image: url(../images/" + Eval("post_image") + ") no-repeat; background-size:cover;" %>'

Upvotes: 1

Related Questions