Skip to main content
Tab

ASPxEditBase.CustomJSProperties Event

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

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.2.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

In some instances, it is necessary to obtain server information on the client. The CustomJSProperties event enables you to declare temporary client properties. Once declared, a property can be accessed on 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 ASPxEditBase‘s base properties.

Note

Typically, using a specifically introduced ASPxEditBase.JSProperties property might be more convenient and efficient than handling the CustomJSProperties event, which is mostly declared for backward compatibility. Refer to the following topic for more information: How to Access Server Data on the Client Side.

Example

The example below demonstrates how to get values stored in a hidden column of the Combo Box control on the client:

<dx:ASPxComboBox ID="ASPxComboBox1" ClientInstanceName="cbox" ValueField="ProductID" DropDownStyle="DropDownList"
    OnCustomJSProperties="ASPxComboBox1_CustomJSProperties" DataSourceID="SqlDataSource1" runat="server" Width="300"> 
    <Columns>
        <dx:ListBoxColumn FieldName="ProductID" />
        <dx:ListBoxColumn FieldName="ProductName" />
        <dx:ListBoxColumn FieldName="CategoryID" />
        <dx:ListBoxColumn FieldName="UnitPrice" Visible="false" />
    </Columns>
</dx:ASPxComboBox>
<dx:ASPxButton ID="ASPxButton1" runat="server" Text="UnitPrice value" AutoPostBack="false">
    <ClientSideEvents Click="function(s, e) {
        var v = cbox.cpHiddenColumnValues[cbox.GetSelectedIndex()];
        alert(v);
        }" />
</dx:ASPxButton>
protected void ASPxComboBox1_CustomJSProperties(object sender, DevExpress.Web.CustomJSPropertiesEventArgs e)
{
    ArrayList list = new ArrayList();
    foreach (ListEditItem item in ASPxComboBox1.Items)
        list.Add(item.GetFieldValue("UnitPrice"));
    e.Properties["cpHiddenColumnValues"] = list;
}

View Example: Combo Box for ASP.NET Web Forms - How to get hidden column values on the client

See Also