I have a tag and im using Razor. Im using the @url.Action html helper to pass a parameter to a method on a controller to retrieve the picture. But kno I want to have this picture as a link so when they click it it would go to a controller and open a different view. So I was trying to do the two options below but its telling me that its missing a "}" for "Tryone". And for "Trytwo" its not giving me any errors but it does not show me the picture as a link. Any ideas of the wright way to do this?

tryone

@foreach (var p in Model)
{   
     <a href= "@Url.Action("Index","Home")>           
    <img width="50" height="50"
          src= "@Url.Action("GetImage", "Sells", new {p.ItemID })" />
     </a>                                        
}

trytwo

@foreach (var p in Model)
{                    
    <img href="@Url.Action("Index","Home")" width="50" height="50"
          src= "@Url.Action("GetImage", "Sells", new {p.ItemID })" />                                                 
}

Related posts

Recent Viewed