Integrating C# code into a WebSQL Expression
You can integrate C# code into every Web SQL expression. This can be either a C# expression or a command string.
To integrate a C# expression into a Web SQL expression, enclose it in double curly brackets, as in the example:
To integrate a C# expression into a Web SQL expression
NOTE: More complex commands are also enclosed in double curly brackets. The return value of the embedded expression is labeled with the keyword @return.
To integrate multiple C# expressions into a Web SQL expression
NOTE: The keyword @return must always be the last command in the embedded expression in this case.
Access to environmental data
The following statistical member variables are defined in all classes that can be modified by code. You can use these to gain access to the runtime environment.
Table 62: Member variables overview
_UserSession |
VI.WebDesigner.Runtime.IUserSession |
User session |
_Form |
VI.WebDesigner.Runtime.IForm |
Form on which the code is run |
_Module |
VI.WebDesigner.Runtime.IModule |
Module in which the code is run. |
_Connection |
VI.DB.IConnection |
Actual database connection |
Referencing controls
The generated Microsoft .NET Framework code creates a structure of ASP.NET controls. A local variable is defined for each control. The name of this variable corresponds to the identifier given to the Web Designer node.
The local variable can be accessed directly from within the same method.
Furthermore, all controls coming from the base class System.Web.UI.Control have an identifier (ID), which also corresponds to the Web Designer node identifier. This makes it easier to locate controls outside the visible range of the local variable.
Referencing collections
Data values can be loaded from or changed in collections using C# code.
Local collections of a module or component are defined in the component's TableStore.
Example:
NOTE: Virtual collections must use a slightly different call. Virtual collections are member variable of the class and can be accessed directly from the C# code using their name.