hi i’m using nvarchar and tryied too ref till the map too display the image like ~/image/pics.jpg. in my tabel i got 3 column id,image and text. id=int, image=nvarchar(max) text= nvarchar(50).
How can I display them? Does anyone know of a guide or tutorial I can follow?
i have search every where but they using binary and image typ. i can only display text and ID if i want but on image it shows the icon that ther should be an image but it didn’t display?
controller
public ActionResult Index()
{
var pics = db.image.ToList();
return View(pics);
}
view
@foreach (var item in Model)
<tr>
<img src='@item.image' />
<tr/>
<tr>
@item.text
<tr/>
I created a helper method that I use in my view:
In my view I have the following:
My view model:
UploadedFile class:
Now how you populate the UploadedFiles property is up to you. I would have done it something like this with a database call:
There is probably a better way to do this, but this will help you in a direction. Hope this helps.