asp.net mvc - Razor encodes quoted html attributes -


i'd conditionally render appropriate html client using construct:

<input type="button" value="foo" @(string.isnullorempty(model.identifier) ? string.format("title={0} disabled=disabled", "lorem ipsum") : "onclick=window.open('http://www.google.com'); return false;") /> 

this output get:

<input type="button" value="foo" title=&quot;lorem ipsum&quot; disabled=disabled /> 

i've tried numerous html.raw() constructs, nothing seems of help. how output correctly unencoded html quotes instead of html entities?

try this. tried , worked me. difference singular quotations marks , html.raw around whole thing

<input type="button" value="foo" @html.raw(string.isnullorempty(model.identifier) ? string.format("title='{0}' disabled='disabled'", "lorem ipsum") : "onclick='window.open(\"http://www.google.com\"); return false;'") /> 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -