Skip to main content

ASPxScheduler.CustomJSProperties Event

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

Namespace: DevExpress.Web.ASPxScheduler

Assembly: DevExpress.Web.ASPxScheduler.v23.2.dll

NuGet Package: DevExpress.Web.Scheduler

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 ASPxScheduler1_CustomJSProperties(object sender, 
DevExpress.Web.CustomJSPropertiesEventArgs e) {
    e.Properties.Add("cpFirstDayOfWeek", ASPxScheduler1.FirstDayOfWeek);
    e.Properties["cpNestedArrays"] = new object[] { 
    "value",
    null,
    new string[] { "name1", "name2" }};
}

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

if (!IsCallback) {
    e.Properties.Add("cpFirstDayOfWeek", ASPxScheduler1.FirstDayOfWeek);
}

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

alert (scheduler.cpFirstDayOfWeek);

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

ASPxScheduler1.JSProperties["cpFirstDayOfWeek"] = "AnyScalarValue";

Concept

How to Access Server Data on the Client Side

See Also