The C# ShowMessage() method has the [WebMethod] attribute. When I put the App.MyClassName.ShowMessage(); line into the aspNetPanel’s InitScript property the method gets called.
Can I make a method in my C# class be called from the PageSource code ?
To achieve your goal, you’ll have to move the script from the “PageSource” HTML file to the application’s Default.html file, or add it to the HtmlPanel’s InitScript property.
You can think of the HtmlPanel as a sandbox, even if you call the “this.App.Window1.HelloWorldFromHTMLSource()” method from firing the click event you’ll get “this.App” is not defined on the Console.
It’s a security measure, so you’ll have to define all the scripts from the beginning in Default.html.
You can check out these forum posts for more details:
You can check out the documentation for more info through this link: Wisej.NET | Widget
I have also attached a modified version of your sample for you to try!
Thanks for your help
is the function declared as public static? Please also note the last paragraph in our docs about RemoteMethods
If it still fails after using the mechanism described there, please wrap up a small repro case that we can use to inspect that issue.
Thanks in advance.
Please login first to submit.