I need to create a function that is only necessary inside one cshtml file. You can think of my situation as ASP.NET page methods, which are min web services implemented in a page, because they're scoped to one page. I know about HTML helpers (extension methods), but my function is just needed in one cshtml file. I don't know how to create a function signature inside a view.
Note: I'm using Razor template engine.
Asp.net-mvc – How to create a function in a cshtml template
asp.net-mvcasp.net-mvc-3razor
Related Topic
- How to use ternary operator in razor (specifically on HTML attributes)
- Asp.net-mvc – ASP.NET MVC 3 – Partial vs Display Template vs Editor Template
- Asp.net-mvc – MVC 4 @Scripts “does not exist”
- Git – failed to push some refs to git@heroku.com:theapp.git
- C# – Set global variable at compile time from cshtml page
- Asp.net-mvc – When should we use Html Helpers, Razor Helpers or Partial Views
Best Answer
why not just declare that function inside the cshtml file?