4
我想使用這個構造條件呈現相應的HTML到客戶端:剃鬚刀報價進行編碼的HTML特性
<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;") />
這是輸出我得到:
<input type="button" value="Foo" title="Lorem ipsum" disabled=disabled />
我已經試過無數Html.Raw()構造,但似乎沒有任何幫助。如何正確輸出未編碼的HTML而不是html實體的引號?
不幸的是這不起作用 – Kyle
@Kyle你是對的,我只是現在測試它 –