【问题标题】:Using a helper page created on a page X in Y?使用在 Y 中的页面 X 上创建的帮助页面?
【发布时间】:2011-09-11 07:53:43
【问题描述】:

我有一个带有以下代码的页面 X.cshtml:

@helper CodeTest{
    <h1>Test</h1>
}

而且在我的页面 Y.cshtml 上喜欢使用这个助手...我怎么称呼他?

【问题讨论】:

    标签: html razor helpers webmatrix


    【解决方案1】:

    将帮助程序从 X.cshtml 移动到 Z.cshtml,您应该将其放入 App_Code。然后您可以从应用程序中的任何位置调用它。

    @Z.CodeTest()
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-23
    • 1970-01-01
    • 1970-01-01
    • 2015-02-01
    • 2016-10-21
    相关资源
    最近更新 更多