You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

Overview

This technical note has information related to how to call a class on HTML5 (@Script.Class.<ClassName>). 


On this page:


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.

Example

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:

CodeBehind Example
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":

Script Example
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.

  • No labels