@Sahan that's not quite true. If Pete is trying to write valid xhtml output then the <img> tag needs to be closed. If he's using html5 it's not a big deal though. However I still prefer the stricter syntax closing tags like in xhtml.
@Pete Don't know if you perhaps need to escape the / sign?
Replacing characters in html string using razor
I can't get this line to produce correctly in HTML
It keeps dropping the / on the img tag, so it doesn't close it.
This is the output:
Hi Pete - According to my experience, the output is correct, because you can't see img closing tag "</img>" or </> in the source.
@Sahan that's not quite true. If Pete is trying to write valid xhtml output then the <img> tag needs to be closed. If he's using html5 it's not a big deal though. However I still prefer the stricter syntax closing tags like in xhtml.
@Pete Don't know if you perhaps need to escape the / sign?
/Jan
You should be able to solve this by using html.raw or just merge the strings inside a codeblock
@{
var myString = "<a href=\""+Model.downloadLink.First.File+ \"" class=pdficon target=_blank><img src='/images/pdf.gif' /></a>";
}
Visit some link right here @myString and continue on
Also in your example your \ is located 1 step to late after file url, i would also recommend using " around class and target including src of the img.
is working on a reply...