Tag: htmlextension

  • HtmlHelper Extenstion to convert HTML to JSON C#

    Let’s create an HTML Extension for C#’s HtmlHelper class that converts a class or object to JSON for use with your JavaScript code. I use this in my MVC projects inside my Razor Views. The solution leverages NewtonSoft’s JsonConvert NuGet package to convert with C# HTML to JSON.

    (more…)

  • C# HtmlExtension to display SVGs

    You have SVGs that you wish to display on your website but you want to be able to re-use them without copying and pasting the code or creating a shared view.

    By creating an HtmlExtension class with a function called Svg you can create a centralized place to store and re-use your SVGs.

    (more…)