Good day, how are you? I am currently working with mvc,c#,sql and I am doing this: I have a viewmodel like this:
public class htmlviewmodel
{
public string Color { get; set; }
public string body { get; set; }
public string style { get; set; }
}
and I am trying to get an image url and show the image in my view, the url comes from my database
entity db = new myentity();
var html = new htmlviewmodel();
html.body="<img src=""+db.getmyimageurl().tostring()+";" > ";
My view would be like the following:
<div> my image: @Model.html.body </div>
but it doesnot show the image, instead it shows a string like this
<img src="imageUrlNotworking....//...;" > "
Is there something I am doing wrong? how can I fix it? thanks!
Aucun commentaire:
Enregistrer un commentaire