Nevron .NET Vision
Framework / Thin Web / Custom Commands
In This Topic
    Custom Commands
    In This Topic

    When the control processes a request from the client on the server it will generate a series of commands which will update the client content in response to the request. Sometimes it is useful to be able to generate custom commands that are processed by custom client side script in order to integrate the control better with the surrounding HTML content.

    In order to inject a custom command in the control response you need to first ensure that you can reference the control on the client using JavaScript. This is done by assigning a custom StateId to the control:

    C#
    Copy Code
    thinWebControl.StateId = "ThinWebControl1";
    Visual Basic
    Copy Code
    thinWebControl.StateId = "ThinWebControl1";

    Then in response to callbacks from the control you can start to inject custom commands in the generated command output stream:

    C#
    Copy Code
    thinWebControl.AddCustomClientCommand("Custom Command Argument");
    Visual Basic
    Copy Code
    thinWebControl.AddCustomClientCommand("Custom Command Argument")

    On the client side you need to register a function that receives custom command notifications. The following JavaScript code shows how to do that:

    JavaScript
    Copy Code

    <script language='javascript'>

    $(document).ready()

    {

    var controlHost = NClientNode.GetFromId("ThinWebControl1");

    controlHost.CustomCommandCallback = function (argument) {

    alert(argument);

    };

    }

    </script>

     

     Related Examples

    Nevron Chart\Web Forms\ThinWeb\Custom Commands