使用ASP.NET MVC 3 APP_ code文件夹中有剃刀@helper [英] Having razor @helper in App_code folder using ASP.NET MVC 3
本文介绍了使用ASP.NET MVC 3 APP_ code文件夹中有剃刀@helper的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在哪里可以找到关于究竟是如何得到这个工作教程?
Where can I find tutorials on how exactly get this to work?
我想在我MVC3应用程序APP_ code目录@helper,到目前为止,当我尝试在其他剃须刀页面使用它们,它们不能被发现。
I am trying to have @helper in App_code directory of my MVC3 app, so far when I try to use them in other razor pages, they cannot be found.
推荐答案
您需要调用助手的页面名称的静态方法。
You need to call the helpers as static methods of the page name.
例如,如果你在 APP_ code / MyHelpers.cshtml
名为 HelpMe
一个帮手,你会写
For example, if you have a helper named HelpMe
in App_Code/MyHelpers.cshtml
, you would write
@MyHelpers.HelpMe(...)
这篇关于使用ASP.NET MVC 3 APP_ code文件夹中有剃刀@helper的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文