ASP.NET MVC3 link with image inside @Html.Raw -


good day, i'm try use action links url.action inside @html.raw in asp.net mvc3 project. works fine without @html.raw, images can't display on page, i'm try use html.encode inside raw, it's show me naked html on page.

@html.raw(<a href="@url.action("actionname", "controller", new {id = 1})" target="_blank">                 <img src="@url.content("~/content/images/simpleimage.png")"/>             </a>) 

any ideas why it's not render right code?also when hover on place image pop me next code: sitename.com/controller/@url.action(

i'm try shielding " it's not help

edit

this action link part of query database, display next:

@html.raw(model.fieldwithhtmlcharactersindatabase) 

you need pass string, try this

@html.raw("<a href='" + @url.action("actionname", "controller", new {id = 1})' " + target='_blank'>                 <img src='" + @url.content("~/content/images/simpleimage.png") " + "/>             </a>") 

Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -