ASPxCardView.InitNewCard Event
Enables you to initialize added cards.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v24.2.dll
Declaration
Event Data
The InitNewCard event's data class is ASPxDataInitNewRowEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
NewValues | Gets a dictionary that contains the new field name/value pairs for the new row. |
Remarks
The InitNewCard event is raised when a new card is added to the ASPxCardView. This occurs when:
- the ASPxClientCardView.AddNewCard or ASPxCardView.AddNewCard method is called;
- an end-user has clicked on the New command button.
Use the event parameter’s NewValues property to specify the values in the new card. Note that you can initialize values only for those columns that are visible within the Edit Form. To specify values of hidden columns, handle the ASPxCardView.CardInserting event.
Example
In this example, the ASPxCardView.InitNewCard
event is handled to initialize the new record’s field values with default values.
The image below shows the result:
protected void ASPxCardView1_InitNewCard(object sender, DevExpress.Web.Data.ASPxDataInitNewRowEventArgs e)
{
e.NewValues["CategoryName"] = "Seafood";
e.NewValues["Description"] = "Seafood and fish";
}