Back to Devexpress

ASPxCardView.StartCardEditing Event

aspnet-devexpress-dot-web-dot-aspxcardview-915f6413.md

latest3.0 KB
Original Source

ASPxCardView.StartCardEditing Event

Enables you to prevent a card from being edited.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
public event ASPxStartCardEditingEventHandler StartCardEditing
vb
Public Event StartCardEditing As ASPxStartCardEditingEventHandler

Event Data

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

PropertyDescription
CancelGets or sets a value indicating whether the event should be canceled. Inherited from CancelEventArgs.
EditingKeyValueGets the processed card’s key value.

Remarks

The StartCardEditing event occurs when an end-user has clicked the Edit command or the ASPxCardView.StartEdit method has been called. To prevent switching the ASPxCardView to edit mode, set the event parameter’s Cancel property to true.

Example

The code example below prohibits a user from editing cards that contain information unrelated to the Sales department.

csharp
string UserDepartment = "Sales";
...
protected void ASPxCardView1_StartCardEditing(object sender, DevExpress.Web.ASPxStartCardEditingEventArgs e)
{
    if (ASPxCardView1.GetCardValuesByKeyValue(e.EditingKeyValue, "Department").ToString() != UserDepartment) {
    e.Cancel = true;
}
aspx
<dx:aspxcardview ID="ASPxCardView1" AutoGenerateColumns="False" runat="server" DataSourceID="ObjectDataSource1" KeyFieldName="Id" OnStartCardEditing="ASPxCardView1_StartCardEditing">
        <Columns>
            <dx:CardViewTextColumn FieldName="Department" VisibleIndex="0" Width="10%">
            </dx:CardViewTextColumn>
    ...
        </Columns>
</dx:aspxcardview>

See Also

GetCardValuesByKeyValue(Object, String[])

CommandButtonInitialize

Card View

ASPxCardView Class

ASPxCardView Members

DevExpress.Web Namespace