ZVenue
ZVenue

Reputation: 5027

Dynamic image loading.

In a Image tag src = path, I want to dynamically load the image by pulling the image name from the database. How can I do that?

<img src="../../Content/themes/base/images/pepsi.jpg" height="100" />

I want to be able to write this some thing like this

<img src="../../Content/themes/base/images/" + model.item.name + """ height="100"/>

I am using MVC3 razor.

Upvotes: 1

Views: 365

Answers (1)

Tae-Sung Shin
Tae-Sung Shin

Reputation: 20643

Have you tried this?

      <img src="../../Content/themes/base/images/@model.item.name" height="100"/>

If not,

      <img src="../../Content/themes/base/images/@(model.item.name)" height="100"/>

Upvotes: 4

Related Questions