Search code examples
c#asp.net-coretag-helpersasp.net-core-tag-helpers

How to prevent Tag Helper rendering and show it in html code tag?


I want to prevent the render tag <partial> using asp.net core helpers. My code is:

<pre>
    <code class="language-html">
        <partial name="~/Breadcrumbs/BreadcrumbTemplate.cshtml" model="breadcrumbs" />
    </code>
</pre>

I need print exactly the same the code, without rendering. Thanks in advance.


Solution

  • Just do something to break up the tag, so it's not interpreted by Razor as a tag to be processed. For example:

    &lt;partial name="~/Breadcrumbs/BreadcrumbTemplate.cshtml" model="breadcrumbs" /&gt;