ASPxCardView.CellEditorInitialize Event
Enables initializing the cell editors displayed within the edit cells.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v24.2.dll
NuGet Package: DevExpress.Web
#Declaration
public event ASPxCardViewEditorEventHandler CellEditorInitialize
#Event Data
The CellEditorInitialize event's data class is ASPxCardViewEditorEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
Column | Gets the data column whose cell editor is being initialized. |
Editor |
Gets the editor currently being processed.
Inherited from ASPx |
Key |
Gets the card key value - an object that uniquely identifies the card. |
Value |
Gets the editor’s value.
Inherited from ASPx |
Visible |
Gets the edited card’s visible index. |
#Remarks
The CellEditorInitialize event is raised when the ASPxCardView is switched to edit mode and enables you to initialize cell editors.
Note
- Since the Cell
Editor event works correctly only when a request is sent to the server to initialize an editor, this event will not be raised after you start editing a new row in Batch edit mode because in this mode, requests are not sent to the server when an editor is activated.Initialize - The Cell
Editor event affects only the edit mode settings (when editors are visible).Initialize - The Cell
Editor event isn’t raised for edit cells that contain custom editors defined using templates.Initialize - The Cell
Editor event fires only for built-in column editors.Initialize
#Examples
The following example illustrates how to use the CellEditorInitialize event to automatically focus the required column’s editor using the editor’s ASPxWebControl.Focus method (the e.Editor event argument).
protected void ASPxCardView1_CellEditorInitialize(object sender, DevExpress.Web.ASPxCardViewEditorEventArgs e) { if (e.Column.FieldName == "TimeFrom") { e.Editor.Focus(); } };
This example demonstrates how to prevent an end-user from changing the unit price. To do this, the CellEditorInitialize event is handled. If the processed edit cell corresponds to a column bound to the ‘UnitPrice’ data field, its editor’s ReadOnly property is set to
true
.protected void ASPxCardView1_CellEditorInitialize(object sender, DevExpress.Web.ASPxCardViewEditorEventArgs e) { if (ASPxGridView1.IsNewCardEditing) return; if (e.Column.FieldName == "UnitPrice") e.Editor.ReadOnly = true; }