A newer version of this page is available. Switch to the current version.

How to: Create a Custom Command Button

The following example illustrates how to create a custom command button for the ASPxCardView control.

The CardView stores its custom command buttons (CardViewCustomCommandButton instances) in its CardViewCommandLayoutItem.CustomButtons collection at the CardViewCommandLayoutItem object's level.


<dx:ASPxCardView ID="ASPxCardView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" KeyFieldName="ProductID">
<SettingsExport ExportSelectedCardsOnly="False"></SettingsExport>
    <Columns>
        <dx:CardViewTextColumn FieldName="ProductName" VisibleIndex="0">
        </dx:CardViewTextColumn>
        <dx:CardViewTextColumn FieldName="UnitPrice" VisibleIndex="1">
        </dx:CardViewTextColumn>
    </Columns>
<EditFormLayoutProperties ColCount="1"></EditFormLayoutProperties>
<CardLayoutProperties ColCount="1">
    <Items>
        <dx:CardViewColumnLayoutItem ColumnName="ProductName" />
        <dx:CardViewColumnLayoutItem ColumnName="UnitPrice" />
        <dx:CardViewCommandLayoutItem ButtonRenderMode="Button">
            <CustomButtons>
                <dx:CardViewCustomCommandButton ID="CustomButtonID"
                    Text="Custom Action" 
                    Styles-Style-Width="100%"></dx:CardViewCustomCommandButton>
            </CustomButtons>
        </dx:CardViewCommandLayoutItem>
    </Items>
</CardLayoutProperties>
<StylesExport>
<Card BorderSize="1" BorderSides="All"></Card>
<Group BorderSize="1" BorderSides="All"></Group>
<TabbedGroup BorderSize="1" BorderSides="All"></TabbedGroup>
<Tab BorderSize="1"></Tab>
</StylesExport>
</dx:ASPxCardView>