Chat now with support
Chat with Support

Identity Manager 8.0 - Web Designer Reference Guide

Web Designer Editor Web Designer Structures and Functions The Web Designer Object Model Working with the Web Designer Web Project Configuration Options Customizing the Web Portal Basics of Web Designer Programming Compiling and Debugging Monitoring Frequent Tasks in the Web Portal

Integrating C# code into a WebSQL Expression

Integrating C# Code into a Web SQL 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

  • Enter the expression in double curly brackets.

    format ("The database user is: {0}",

    {{ _Connection.User.Display }} )

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

  • Enter the expression in double curly brackets and use the keyword @return.

    format ("User is: {0}",

    {{ string display = _Connection.User.Display;

    @return display; }} )

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 execution environment.

Table 59: Member variables overview
Name Type Description
_UserSession VI.WebDesigner.Runtime.IUserSession User session
_Form VI.WebDesigner.Runtime.IForm Form on which the code is executed
_Module VI.WebDesigner.Runtime.IModule Module in which the code is executed.
_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:

    TableStore.GetTable("SomeCollection")

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.

Related Documents