I have a myPage.cshtml page. i have written a @helper method( myMethod() ) in myHelper.cshtml. I can call the helper method inline in the page ( @myHelper.myMethod(); ) and it works just fine.
How do i call this same method from a user initiated event like ( menu.item.click, button.click, link click ) ?
Because your method executes in server-side code, you’ll have to create a way to call the code on your server from the client. For example, you could have an action method like this:
…where the
myHelperCallerView contains a call to yourmyMethod()helper method.Then to call that from the client you’d use something like: