I have the following HTML from MVC1.
<img alt="<%= Html.Encode(item.Name) %>" src='<%= this.Url.Action("Image",
"Products") + "/" + item.ID.ToString()%>' width="64" height="64" />
How would I use this for MVC 3, I have tried the following it’s not working…
<img alt=" @Html.Encode(item.Name)" src='<@this.Url.Action(("Image",
"Products")) + "/" + Picture1.SubProductCategoryID.ToString()>'
width="64" height="64" />
Thanks in advance
I’m making some assumptions but:
If you have a statement instead of a simple action invocation, you need to surround the entire statement with parens
(). Also, you needed to drop the<>around the helper. @SLaks is right about not needing theHtml.Encode, too.