ASPxClientEditBase.GetValue Method
Returns the editor’s value.
Declaration
GetValue(): any
Returns
Type | Description |
---|---|
any | An object representing the editor’s value. |
Remarks
Use the GetEditValue method to access the value being edited by an editor.
The editor’s edited value can be represented by different data entities, depending upon the editor type. So, for a text editor this method returns a value identical to the text contained with the editor. However, for a check editor it returns ASPxCheckBox.ValueChecked or ASPxCheckBox.ValueUnchecked, depending upon the current editor’s state. The edited value of a list box editor is specified by the ListEditItem.Value property of the currently selected list item. For an ASPxGridLookup, this method returns a value identical to the text contained within the edit box.
The GetText and the GetValue
methods can return an incorrect (empty or previous) value in the client-side UserInput, KeyDown, KeyPress, and KeyUp event handlers when you apply a format, mask, or null text settings to a text editor.
In this case, obtain the editor’s text from the editor’s input element:
function OnUserInput(s, e) {
var currentText = s.GetInputElement().value;
}
For more information refer to the following Support Center ticket: ticket.
Example
function OnValidationCompleted(s, e) {
if(e.isValid && Password.GetValue() != ConfirmedPassword.GetValue()) {
ConfirmedPassword.SetFocus();
ErrorMessageNotEqual.SetVisible(true);
e.isValid = false;
} else
ErrorMessageNotEqual.SetVisible(false);
}
<script runat="server">
protected void Page_Load(object sender, EventArgs e) {
}
protected void ASPxGlobalEvents1_ValidationCompleted(object sender,
DevExpress.Web.ValidationCompletedEventArgs e) {
lErrorMessageNotEqual.ClientVisible
= !tbPassword.Value.Equals(tbConfirmedPassword.Value);
}
</script>
...
Type password:<br/>
<dxe:ASPxTextBox ID="tbPassword" runat="server" Width="170px"
ClientInstanceName="Password" Password="True">
<ValidationSettings SetFocusOnError="true">
<RequiredField IsRequired="True" />
</ValidationSettings>
</dxe:ASPxTextBox>
<br/>
Confirm password:
<dxe:ASPxTextBox ID="tbConfirmedPassword" runat="server" Width="170px"
ClientInstanceName="ConfirmedPassword" Password="True">
<ValidationSettings SetFocusOnError="true">
<RequiredField IsRequired="True" />
</ValidationSettings>
</dxe:ASPxTextBox>
...