Click here to Skip to main content
15,888,984 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi,
I am trying to load the image dynamically from the database,for that i used like
HTML
<img src='@Url.Action("GetImage/${ID}", "Home")'  alt = "${name} image" />
but it not reflecting to the controller,but if i put statically like
<img src='@Url.Action("GetImage/1", "Home")'  alt = "${name} image" />

then it is going to the controller and it is displaying image .

my controller code is:
C#
public ActionResult GetImage(int id)
        {
            var imgquery = (from img in dbContext.Listdetails where img.ID == id 
                            select new
                            {
                                Image = img.Image
                            }).FirstOrDefault();
            {
                System.IO.MemoryStream outStream = new System.IO.MemoryStream();
                byte[] Image = imgquery.Image;
                return File(Image, "Image/jpg");
            }
        }

Any suggestions..
Posted
Updated 7-Jun-12 16:48pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900