Modularity for functions in view
Is it possible for me to package the code to be used in my view into a function, and then call aforementioned function in the view?
If you look at my image, the code is messy as all heck because I'm using @ notation to put it directly into a div. I'm looking for a way to clean up the code.
2 Replies
Could create a helper: https://learn.microsoft.com/en-us/aspnet/web-pages/overview/ui-layouts-and-themes/creating-and-using-a-helper-in-an-aspnet-web-pages-site
Creating and Using a Helper in an ASP.NET Web Pages (Razor) Site
This article describes how to create a helper in an ASP.NET Web Pages (Razor) website. A helper is a reusable component that includes code and markup to perf...
You can't package a function. Functions reside in classes which are in assemblies. That's what you can package. After that, it can be used like any other class.