开发者

Using a helper page created on a page X in Y?

开发者 https://www.devze.com 2023-03-11 05:07 出处:网络
I have a page X.cshtml with the following code: 开发者_C百科@helper CodeTest{ <h1>Test</h1>

I have a page X.cshtml with the following code:

开发者_C百科
@helper CodeTest{
    <h1>Test</h1>
}

And on my page Y.cshtml like to use this helper ... how can I call him?


Move the helper from X.cshtml to Z.cshtml, which you should put in App_Code. Then you can call it from anywhere in your application.

@Z.CodeTest()
0

精彩评论

暂无评论...
验证码 换一张
取 消