Creating Custom HTML Helpers
Creating custom html code blocks which can be re-used in the entire project. Step1: Add a folder "App_Code" in the root directory. Step2: Add a .cshtml file in the App_Code folder "CustomHelpers.cshml" @helper HomeHelper(){ <h1>Home Page Helper</h1> } Step3: Call the newly added helper code in our existing .cshtml page @{ ViewBag.Title = "Home Page"; Layout = "~/Views/Shared/_Layout.cshtml"; } <h2> Home Page</h2> <div> @CustomHelper.HomeHelper(); </div>