I'm using MVC and I've created a HtmlHelper extension function ImageLink. This function uses two TagBuilder objects to build an HTML image link (like <a><img/></a>
).
It works fine, but now I have a page on which the action for the image button should first be confirmed. So, I added an onclick attribute with "javascript: return confirm('confirm me');" as the onclick code.
This renders as: onclick="javascript:return confirm('confirm me');"
I though this wouldn't work, but it does. But now when we enter:
"javascript: return confirm('confirm me\r\nnewline');"
this renders as:
onclick="javascript:return confirm('confirm me newline');"
which doesn't work.
I'd prefer for the TagBuilder not to encode anything at all and just let me take care of it. But since it does, I'm now looking for a way to get this working properly.