Back to Devexpress

ASPxCardView.CustomJSProperties Event

aspnet-devexpress-dot-web-dot-aspxcardview-7be794a5.md

latest3.3 KB
Original Source

ASPxCardView.CustomJSProperties Event

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

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
public event ASPxCardViewClientJSPropertiesEventHandler CustomJSProperties
vb
Public Event CustomJSProperties As ASPxCardViewClientJSPropertiesEventHandler

Event Data

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

PropertyDescription
PropertiesGets a collection of temporary client properties. Inherited from CustomJSPropertiesEventArgs.

Remarks

In some instances, it is necessary to obtain server information (for instance, the currently active page) on the client. The CustomJSProperties event enables you to declare temporary client properties. Once declared, a property can be accessed on the client.

The CustomJSProperties event is raised every time a grid is rendered on the server to allow a developer to pass required information to the client.

To add new properties, use the event parameter’s CustomJSPropertiesEventArgs.Properties property, which represents a collection of property names and their values. The only requirement is that property names must begin with the ‘cp’ prefix, to avoid rewriting the ASPxCardView base properties.

Note

Typically, using a specifically introduced ASPxGridBase.JSProperties property might be more convenient and efficient than handling the CustomJSProperties event, which is mostly declared for backward compatibility.

Concept

How to Access Server Data on the Client Side

Example

This example demonstrates how to obtain server data from the client. A temporary client property, cpPageIndex , is declared within the ASPxCardView.CustomJSProperties event handler. This property holds the index of the page currently active, and can be accessed on the client.

csharp
protected void ASPxCardView1_CustomJSProperties(object sender, DevExpress.Web.ASPxCardViewClientJSPropertiesEventArgs e)
{
    e.Properties["cpPageIndex"] = ASPxCardView1.PageIndex;
}

See Also

JSProperties

Passing Values from the Server to the Client

Card View

ASPxCardView Class

ASPxCardView Members

DevExpress.Web Namespace