A newer version of this page is available. Switch to the current version.

SupportClientScriptsExtensions.SetClientScript(ISupportClientScripts, String) Method

Assigns a JavaScript code to the current Action. This code is executed in a browser when a user clicks the Action.

Namespace: DevExpress.ExpressApp.Actions

Assembly: DevExpress.ExpressApp.Web.v18.2.dll


public static void SetClientScript(
    this ISupportClientScripts action,
    string script
Public Shared Sub SetClientScript(
    action As ISupportClientScripts,
    script As String


Name Type Description
action DevExpress.ExpressApp.Actions.ISupportClientScripts

An ISupportClientScript object specifying an Action.

script String

A string specifying the JavaScript code to be executed when a user clicks the current Action.


Use this overload to assign a custom script to a specified Action. The overload executes the SetClientScript(ISupportClientScripts, String, Boolean) method with true as the processOnServer parameter.

When a user clicks the specified Action, the custom script is executed on the client side, and then the Action's default code is executed on the server. If the custom script returns true, the script is executed on the client side, but the server does not process the Action's default code.

The following example demonstrates how you can use the SetClientScript method in your code.

using System.Web;
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Actions;
using DevExpress.Persistent.Base;
// ...
public class SampleController : ViewController {
  public SampleController() {
    SimpleAction action = 
    new SimpleAction(this, "ActionWithScript", PredefinedCategory.Edit);
      ("alert('About to execute the {0} action.');", 
See Also