Back to Devexpress

CustomJSPropertiesEventArgs.Properties Property

aspnet-devexpress-dot-web-dot-customjspropertieseventargs.md

latest4.1 KB
Original Source

CustomJSPropertiesEventArgs.Properties Property

Gets a collection of temporary client properties.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
public Dictionary<string, object> Properties { get; }
vb
Public ReadOnly Property Properties As Dictionary(Of String, Object)

Property Value

TypeDescription
Dictionary<String, Object>

The collection of property names and values.

|

Remarks

Run Demo: (Web Forms) ASPxGridView - Select All RowsRun Demo: (MVC) GridView - Select All Rows

Use the event parameter’s Properties property to add new properties that can be accessed on the client.

Note

The only requirement is that property names must begin with the ‘cp’ prefix to avoid rewriting the object’s base properties.

Example

Web Forms:

aspx
<dx:ASPxGridView ID="grid" OnCustomJSProperties="GridView_CustomJSProperties" ...>
    ...
</dx:ASPxGridView>
csharp
protected void GridView_CustomJSProperties(object sender, ASPxGridViewClientJSPropertiesEventArgs e) {
    e.Properties["cpVisibleRowCount"] = grid.VisibleRowCount;
    e.Properties["cpFilteredRowCountWithoutPage"] = GetFilteredRowCountWithoutPage();
}
js
function GetSelectedFilteredRowCount() {
    return grid.cpFilteredRowCountWithoutPage + grid.GetSelectedKeysOnPage().length;
}

MVC:

csharp
settings.CustomJSProperties = (s, e) => {
    var grid = s as MVCxGridView;
    e.Properties["cpVisibleRowCount"] = grid.VisibleRowCount;
    e.Properties["cpFilteredRowCountWithoutPage"] = GetFilteredRowCountWithoutPage(grid);
};
js
function GetSelectedFilteredRowCount() {
  return grid.cpFilteredRowCountWithoutPage + grid.GetSelectedKeysOnPage().length;
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Properties property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

asp-net-web-forms-grid-cache-data-on-the-client-side/CS/Solution/Default.aspx.cs#L15

csharp
}
e.Properties["cpTitleId"] = titleId;
e.Properties["cpTitles"] = titles;

asp-net-web-forms-grid-cache-data-on-the-client-side/VB/Solution/Default.aspx.vb#L21

vb
e.Properties("cpTitleId") = titleId
e.Properties("cpTitles") = titles

See Also

CustomJSPropertiesEventArgs Class

CustomJSPropertiesEventArgs Members

DevExpress.Web Namespace