Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Overview

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


On this page:

Table of Contents
maxLevel

2

3


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:

Code Block
titleCodeBehind Example
linenumberstrue
[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":

Code Block
titleScript Example
linenumberstrue
[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...

Page Tree
root@parent
spacesV10