Back to Devexpress

ASPxButton.Click Event

aspnet-devexpress-dot-web-dot-aspxbutton-68b0f1f4.md

latest3.9 KB
Original Source

ASPxButton.Click Event

Fires when the button is clicked.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
public event EventHandler Click
vb
Public Event Click As EventHandler

Event Data

The Click event's data class is EventArgs.

Remarks

Handle the Click event to perform server-side processing of button clicks.

Note

When some buttons are used in a group (their ASPxButton.GroupName properties are set to the same value) a click on a checked button doesn’t raise the Click event.

Example

The complete sample project is available in the DevExpress Code Central database: How to add buttons to a pop-up window.

cshtml
<dx:ASPxButton ID="btnOK" runat="server" AutoPostBack="False" Text="OK" Width="80px"
    OnClick="btnOK_Click">
    <ClientSideEvents Click="function(s, e) { popupControl.Hide();
            // Processes data on the client
            e.processOnServer = true;
            // Processes data on the server
        }" />
</dx:ASPxButton>
csharp
protected void Page_Load(object sender, EventArgs e) {
}

protected void btnOK_Click(object sender, EventArgs e) {
    // Processes data on the server
    ASPxTextBox1.Text = ASPxTextBox2.Text;
}
vb
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
End Sub

Protected Sub btnOK_Click(ByVal sender As Object, ByVal e As EventArgs)
    ' Processes data on the server
    ASPxTextBox1.Text = ASPxTextBox2.Text
End Sub

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Click event.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

xaf-win-add-custom-button-to-form-using-custom-view-item/CS/MySolution.Module.Web/ButtonDetailViewItemWeb.cs#L17

csharp
button.EnableClientSideAPI = true;
button.Click += new EventHandler(button_Click);
return button;

xaf-win-add-custom-button-to-form-using-custom-view-item/VB/MySolution.Module.Web/ButtonDetailViewItemWeb.vb#L24

vb
button.EnableClientSideAPI = True
AddHandler button.Click, AddressOf button_Click
Return button

Implements

Click

See Also

Click

ASPxButton Class

ASPxButton Members

DevExpress.Web Namespace