Back to Devexpress

ASPxCardViewCommandButtonEventArgs.ButtonType Property

aspnet-devexpress-dot-web-dot-aspxcardviewcommandbuttoneventargs.md

latest5.0 KB
Original Source

ASPxCardViewCommandButtonEventArgs.ButtonType Property

Gets the type of the command button currently being initialized.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
public CardViewCommandButtonType ButtonType { get; }
vb
Public ReadOnly Property ButtonType As CardViewCommandButtonType

Property Value

TypeDescription
CardViewCommandButtonType

One of the ColumnCommandButtonType enumeration values.

|

Available values:

Show 12 items

NameDescription
Edit

Corresponds to the Edit command. Switches the ASPxCardView to edit mode.

| | New |

Corresponds to the New command. Creates a new card.

| | Delete |

Corresponds to the Delete command. Deletes the current card.

| | Select |

Corresponds to the Select command. Selects/deselects cards.

| | Update |

Corresponds to the Update command. Saves all the changes made to the current card and switches the ASPxCardView to browse mode.

| | Cancel |

Corresponds to the Cancel command. Discards any changes made to the current card and switches the ASPxCardView to browse mode.

| | UpdateSummaries |

Corresponds to the Update summaries command. Recalculates total and group summaries when a user increases a cell value that was equal to the calculated minimum or decreases a value that was equal to the calculated maximum.

| | SelectCheckbox |

Corresponds to the Select command initiated via a select check box or radio button. Selects/deselects cards.

| | ApplySearchPanelFilter |

Corresponds to the Apply command. Applies the filter specified in the search panel.

| | ClearSearchPanelFilter |

Corresponds to the Clear command. Clears the filter specified in the search panel.

| | EndlessPagingShowMoreCards |

Corresponds to the Show more cards link. Loads cards on demand when endless paging is enabled.

| | Recover |

Corresponds to the Recover command. Recovers the deleted cards.

|

Example

The following example uses an external check box to change the visibility of ASPxCardView check boxes in multi-selection mode.

aspx
<dx:ASPxCheckBox ID="chkDisabled" runat="server" Text="Disable selection checkboxes"
    AutoPostBack="true" />

<dx:ASPxCardView ID="ASPxCardView1" runat="server" DataSourceID="AccessDataSource1" KeyFieldName="CustomerID" OnCommandButtonInitialize="ASPxCardView1_CommandButtonInitialize" AutoGenerateColumns="False">
    <Columns>
        <dx:CardViewTextColumn FieldName="CompanyName" />
        <dx:CardViewTextColumn FieldName="ContactName" />
        <dx:CardViewTextColumn FieldName="City" />
        <dx:CardViewTextColumn FieldName="Region" />
        <dx:CardViewTextColumn FieldName="Country" />
    </Columns>
    <CardLayoutProperties>
        <Items>
            <dx:CardViewCommandLayoutItem HorizontalAlign="Right" ShowSelectCheckbox="True" />
            <dx:CardViewColumnLayoutItem ColumnName="Company Name" />
            <dx:CardViewColumnLayoutItem ColumnName="Contact Name" />
            <dx:CardViewColumnLayoutItem ColumnName="City" />
            <dx:CardViewColumnLayoutItem ColumnName="Region" />
            <dx:CardViewColumnLayoutItem ColumnName="Country" />
            <dx:EditModeCommandLayoutItem HorizontalAlign="Right" />
        </Items>
    </CardLayoutProperties>
</dx:ASPxCardView>  
<asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/nwind.mdb"
    SelectCommand="SELECT * FROM [Customers]" />
csharp
protected void ASPxCardView1_CommandButtonInitialize(object sender, DevExpress.Web.ASPxCardViewCommandButtonEventArgs e) {
    if (e.ButtonType == CardViewCommandButtonType.SelectCheckbox)
        e.Visible = !chkDisabled.Checked;
}
vb
Protected Sub ASPxCardView1_CommandButtonInitialize(ByVal sender As Object, ByVal e As DevExpress.Web.ASPxCardViewCommandButtonEventArgs)
    If e.ButtonType = CardViewCommandButtonType.SelectCheckbox Then
        e.Visible = Not chkDisabled.Checked
    End If
End Sub

See Also

ASPxCardViewCommandButtonEventArgs Class

ASPxCardViewCommandButtonEventArgs Members

DevExpress.Web Namespace