KTML 4 API Documentation for ASP .NET

KtmlGenericModule Class

Base class for any custom KTML module.

For a list of all members of this type, see KtmlGenericModule Members.

System.Object
   InterAKT.WebControls.Modules.KtmlGenericModule

public abstract class KtmlGenericModule

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

In order to implement a custom module you must create a new project, add a reference to InterAKT.KTML4 assembly in your project and derive from the class InterAKT.WebControls.Modules.GenericModule. The custom module class must be implemented in the namespace InterAKT.WebControls.Modules and must be named like Ktml[ModuleName]Module. Compile the project, add the assembly to the /bin folder of the web application and then add a <module> tag under <KTML4_custom_modules> in ktm4.config.xml. file:

    <KTML4_custom_modules>
        <module name="[ModuleName]" assembly="~/bin/[YourCustomModuleAssembly].dll" methods="MethodNamesSeparatedByComma"/>
    </KTML4_custom_modules>

Example

Here's a sample of a custom module KtmlDateModule with two methods: GetCurrentDate and AnotherTestMethod that will be compiled in the assembly KtmlDateCustomModule.dll:

using System;
using System.Collections;
using System.Web;
using System.Text;

namespace InterAKT.WebControls.Modules
{
    public class KtmlDateModule : KtmlGenericModule
    {
        public string GetCurrentDate()
        {
            return DateTime.Now.ToString();
        }

        public Object AnotherTestMethod()
        {
            if (DateTime.Now.Second % 2 == 0)
            {
                // throw an error when seconds are even
                KtmlError ke = new KtmlError("Seconds are even!", null);
                SetError(ke);
                return ke;
            }
            else
            {
                return DateTime.Now;
            }
        }
    }
}
The ktml4.config.xml file must have the corresponding:
    <KTML4_custom_modules>
        <module name="Date" assembly="~/bin/KtmlDateCustomModule.dll" methods="GetCurrentDate,AnotherTestMethod"/>
    </KTML4_custom_modules>

Requirements

Namespace: InterAKT.WebControls.Modules

Assembly: InterAKT.KTML4 (in InterAKT.KTML4.dll)

See Also

KtmlGenericModule Members | InterAKT.WebControls.Modules Namespace