You are viewing an old version of this page. View the current version.
Compare with Current
View Page History
Version 1
Next »
This technical note has information related to how to call a class on HTML5 (@Script.Class.<ClassName>).
The problem
Framework does not allow to call a class on HTML5
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.
The solution
The implementation
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:
[Language: JavaScript]
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":
[Language: C#]
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.
In this section...
The root page @parent could not be found in space v10.