I was working on NopCommerce, and it has an HTML helper @T("") that takes a string key and fetches its value from the database.
I want to implement this in my project. I googled a lot but didn't find any help on how they created a helper method like this.
Can somebody help me creating similar helper like this?
You need to tell razor to use your own
WebViewPage. You declare this inside theweb.configfile underViewsfolder. Your customWebViewPagemust be specified in thepageBaseTypeattribute of thepageselement. All the cshtml implementations will inherit your customWebViewPageand you can access the pulic or protected properties and method of your customWebViewPage.