Back to Devexpress

ASPxEdit.ValueChanged Event

aspnet-devexpress-dot-web-dot-aspxedit-2de002bc.md

latest2.9 KB
Original Source

ASPxEdit.ValueChanged Event

Fires when the control accepts the new value entered by a user.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
public event EventHandler ValueChanged
vb
Public Event ValueChanged As EventHandler

Event Data

The ValueChanged event's data class is EventArgs.

Remarks

The control raises the ValueChanged event after it accepts the value entered by a user. To accept the new value, a user can press Enter, or defocus the value field (press Tab, or click another page area).

To allow the editor to raise the server-side ValueChanged event, use one of the following options:

  • Set the AutoPostBack property to true.

  • In the client-side ValueChanged event handler, set the processOnServer argument property to true. In this case, the editor raises the client-side event and then raises the server-side ValueChanged event.

  • ASPX

aspx
<dx:ASPxComboBox ID="ASPxComboBox1" runat="server">
    <Items>
        <dx:ListEditItem Text="Item1" Value="10" />
        <dx:ListEditItem Text="Item2" Value="20" />
    </Items>
</dx:ASPxComboBox>

<dx:ASPxSpinEdit ID="ASPxSpinEdit1" runat="server" OnValueChanged="ASPxSpinEdit1_ValueChanged"
    Number="0" MinValue="0" MaxValue="1" AutoPostBack="true">
</dx:ASPxSpinEdit>
csharp
protected void ASPxSpinEdit1_ValueChanged(object sender, EventArgs e) {
    var spinEdit = sender as ASPxSpinEdit;
    ASPxComboBox1.SelectedIndex = Convert.ToInt32(spinEdit.Value);
}
vb
Protected Sub ASPxSpinEdit1_ValueChanged(ByVal sender As Object, ByVal e As EventArgs)
    Dim spinEdit = TryCast(sender, ASPxSpinEdit)
    ASPxComboBox1.SelectedIndex = Convert.ToInt32(spinEdit.Value)
End Sub

ASPxGridLookup Limitations

  • When the ASPxGridLookup editor’s value changes, the editor sends a callback to the server to synchronize its value with the internal ASPxGridView control’s selection. Because of this, the server-side ValueChanged event fires before the client-side ValueChanged event.

See Also

ASPxEdit Class

ASPxEdit Members

DevExpress.Web Namespace