Tab

ASPxGridBase.JSProperties Property

Enables you to supply any server with data that can then be parsed on the client.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v20.2.dll

Declaration

public Dictionary<string, object> JSProperties { get; }

Property Value

Type Description
Dictionary<String, Object>

The collection of property names and their values.

Remarks

In some instances, it is necessary to obtain server information on the client. The JSProperties property enables you to declare temporary client properties. The JSProperties property represents a collection of property names and their values. Once declared, a property can be accessed on the client.

NOTE

The only requirement is that property names must begin with the 'cp' prefix, to avoid rewriting the control's base properties.

Example

Web Forms approach:

protected void grid_RowUpdated(object sender, DevExpress.Web.Data.ASPxDataUpdatedEventArgs e) {
    (sender as ASPxGridView).JSProperties["cpResult"] = returnValue;
}

MVC approach:

settings.BeforeGetCallbackResult = (s, e) => {
    MVCxGridView grid = (MVCxGridView)s;
    if (grid.Selection.Count > 0)
        grid.JSProperties["cpSelectedRowKey"] = grid.GetSelectedFieldValues("Id")[0].ToString();
    else {
        grid.JSProperties["cpSelectedRowKey"] = false;
    }
};
See Also