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"
Call the newly added helper code in our existing .cshtml page
Step1:
Add a folder "App_Code" in the root directory.
Step2:
Add a .cshtml file in the App_Code folder "CustomHelpers.cshml"
@helper HomeHelper(){Step3:
<h1>Home Page Helper</h1>
}
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>