This technical note has information related to how to call a class on HTML5 (@Script.Class.<ClassName>
).
On this page:
It is not possible to call @Script.Class
using default method that is used on WPF Pages.
You can see that there is no option to call a class. The following topic shows how to make it possible.
To make the call of classes on a HTML5 page possible, it is necessary to execute a code behind where a TK.ExecuteClassMethodOnServer
is called.
You can see an example of the implementation:
this.MouseLeftButtonDown1 = function(sender, e) { var parameters = new Array("Tag1"); var result = TK.ExecuteClassMethodOnServer("TagDescription", "Func", parameters); } |
Where:
TagDesciption: Edit → Scripts → Classes → "Class Name"
Func: Edit → Scripts → Classes → "Class Name" → "Function Name"
Parameters: Tag passed as parameter
You can see in the Code Block below an example of the Script implementation calling the function "func":
public string Func(String TagName) { string tag = TagName; return tag + TK.GetObjectValue("Tag." + TagName + ".Description"); } |
In our case, it will return the Tag Name and its description. Following those steps you can call a Class from HTML5.