Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

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

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

like image 462
ridermansb Avatar asked Oct 10 '22 19:10

ridermansb


1 Answers

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()
like image 69
Mike Brind Avatar answered Nov 21 '22 19:11

Mike Brind