Skip to main content
A newer version of this page is available. .

ASPxDashboardViewer.CustomJSProperties Event

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

Namespace: DevExpress.DashboardWeb

Assembly: DevExpress.Dashboard.v18.2.Web.WebForms.dll

Declaration

public event CustomJSPropertiesEventHandler CustomJSProperties

Event Data

The CustomJSProperties event's data class is CustomJSPropertiesEventArgs. The following properties provide information specific to this event:

Property Description
Properties Gets a collection of temporary client properties.

Remarks

Sometimes, it is necessary to obtain server information on the client side. The CustomJSProperties event enables you to declare temporary client properties to store the necessary information. Once declared, a property can be accessed on the client using common syntax.

Add new properties via the event parameter’s Properties property, which represents a collection of property names and their values. You have to add “cp” prefix to custom property names, in order to avoid rewriting the base properties. The code snippet below provides an illustration of this:

protected void ASPxDashboardViewer1_CustomJSProperties(object sender, 
    DevExpress.Web.CustomJSPropertiesEventArgs e) {
    e.Properties.Add("cpDashboardSource", ASPxDashboardViewer1.DashboardSource.ToString());
}

The CustomJSProperties event is raised on callbacks. You may check for this to prevent a variable from unnecessary initialization:

if (!IsCallback) {
    e.Properties.Add("cpDashboardSource", ASPxDashboardViewer1.DashboardSource.ToString());
}

Then, you can obtain a custom property’s value via the client object’s cpMyProperty:

function OnDashboardLoaded() {
      alert("The dashboard is loaded from "+webVeiwer.cpDashboardSource);
}

On the server it can be accessed by means of the ASPxDashboardViewer.JSProperties property.

ASPxDashboardViewer1.JSProperties["cpDashboardSource"] = "AnyStringValue";
See Also