Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I came across this problem yesterday, so I found a solution that doesn't require you to remove the encoder.</p> <pre><code>using System.Web; using System.Web.Mvc; using System.Web.Security.AntiXss; using System.Web.Util; namespace Your.Namespace.Here { public static class KendoMvcExtensions { public static IHtmlString ToMvcClientTemplate(this MvcHtmlString mvcString) { if (HttpEncoder.Current.GetType() == typeof (AntiXssEncoder)) { var initial = mvcString.ToHtmlString(); var corrected = initial.Replace("\\u0026", "&amp;").Replace("%23", "#").Replace("%3D", "=").Replace("&amp;#32;", " "); return new HtmlString(corrected); } return mvcString; } } } </code></pre> <p>It checks to see if the <code>AntiXssEncoder</code> is active, and if it is, it removes the offending encoding characters. You can take out the encoder check if you want, but don't change the order that the characters are replaced... it is structured that way because .NET will make some of the characters (especially validator text) have mixed encoding (UTF-8 and Unicode in the same character set, example: <code>\u0026#32</code>, which un-encoded once becomes <code>&amp;#32</code> and un-encoded twice becomes <code>" "</code>).</p> <p>To use it, just call <code>.ToMvcClientTemplate()</code> at the end of any offending control declaration. In the case of the OP, you would put it right after the closing parenthesis before you close the div.</p> <p><a href="https://gist.github.com/advancedrei/5724537" rel="nofollow">I'm keeping a copy of this code here</a> in case someone somewhere else posts a better solution, as I've posted this code in several places.</p> <p>HTH</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload