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

ASPxButton Class

A button control.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v19.2.dll

Declaration

public class ASPxButton :
    ASPxWebControl,
    IButtonControl,
    IRequiresLoadPostDataControl,
    IAssociatedControlID
Public Class ASPxButton
    Inherits ASPxWebControl
    Implements IButtonControl,
               IRequiresLoadPostDataControl,
               IAssociatedControlID

Remarks

The Button offers extended functionality not available with the standard ASP.NET button. It ships with an enhanced client API and supports the DevExpress appearance customization engine.

ASPxButton_control.png

Create a Button

Design Time

The ASPxButton control is available on the DX.19.2: Common Controls toolbox tab in the Microsoft Visual Studio IDE.

UploadControl_Toolbox.png

Drag the control onto a form and customize control settings, or paste the control markup in the page's source code.

<dx:ASPxButton ID="MyButton" runat="server" Text="Show Alert" AutoPostBack="False" >
     <ClientSideEvents Click="function(s, e) {alert('Hello, world');}" />
</dx:ASPxButton>

Run Time

using DevExpress.Web;
...
protected void Page_Load(object sender, EventArgs e) {
     ASPxButton button = new ASPxButton();
     button.ID = "MyButton";
     button.Text = "Show Alert";
     button.AutoPostBack = false;
     button.ClientSideEvents.Click = "function(s, e) {alert('Hello, world');}";
     // Add the created control to the page
     Page.Form.Controls.Add(button);
}

Client-Side API

The ASPxButton's client-side API is implemented with JavaScript language and exposed by the ASPxClientButton object.

Availability

Available if the EnableClientSideAPI property is set to true, or the ClientInstanceName property is defined, or any client event is handled.

Class name

ASPxClientButton

Access name

ClientInstanceName

Events

ASPxButton.ClientSideEvents

Features

Render Modes

Use the RenderMode property to specify how the ASPxButton control is rendered on the page. The ButtonRenderMode enumeration lists the property's available values.

Set the Native property to true to render the ASPxButton control as a native input element.

<dx:ASPxButton ID="btnNewItem" runat="server" RenderMode="Link" Text="New Item" AutoPostBack="false"  
    ImagePosition="Right" Image-IconID="actions_additem_16x16gray" />
<dx:ASPxButton ID="btnDelete&