Back to Devexpress

ASPxCaptcha.ValidationSettings Property

aspnet-devexpress-dot-web-dot-aspxcaptcha-79f7da25.md

latest3.5 KB
Original Source

ASPxCaptcha.ValidationSettings Property

Gets the editor’s validation settings.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
public CaptchaValidationSettings ValidationSettings { get; }
vb
Public ReadOnly Property ValidationSettings As CaptchaValidationSettings

Property Value

TypeDescription
CaptchaValidationSettings

A CaptchaValidationSettings object that contains validation settings.

|

Remarks

Use the ValidationSettings property to access and customize the settings that relate to editor validation.

Example

The following part of the ASPxCaptcha - Features online demo illustrates how to customize the challenge image‘s style settings.

These settings are specified within a panel (ASPxComboBox, ASPxColorEdit editors) and applied to the captcha control via the Apply button (ASPxButton).

csharp
protected void btnApply_Click(object sender, EventArgs e) {
...
    int parseResult = 0;
    Captcha.ChallengeImage.FontFamily = cbFontFamily.Value.ToString();
    Captcha.ChallengeImage.ForegroundColor = ceForegroundColor.Color;
    Captcha.ChallengeImage.BackgroundColor = ceBackgroundColor.Color;
    Captcha.ChallengeImage.BorderColor = ceBorderColor.Color;
    if (int.TryParse(seBorderWidth.Text, out parseResult))
        Captcha.ChallengeImage.BorderWidth = parseResult;
...
}
aspx
<dx:ASPxCaptcha ID="Captcha" runat="server" Width="402px">
    <ValidationSettings ErrorDisplayMode="Text">
    </ValidationSettings>
</dx:ASPxCaptcha>
...
<dx:ASPxComboBox ID="cbFontFamily" runat="server" Width="170px" ValueType="System.String">
    <Items>
        <dx:ListEditItem Text="Times New Roman" Value="Times New Roman" />
        <dx:ListEditItem Text="Courier New" Value="Courier New" />
        <dx:ListEditItem Text="Georgia" Value="Georgia" />
        <dx:ListEditItem Text="Tahoma" Value="Tahoma" />
        <dx:ListEditItem Text="Verdana" Value="Verdana" />
    </Items>
</dx:ASPxComboBox>
...
<dx:ASPxColorEdit ID="ceForegroundColor" runat="server" Width="170px">
</dx:ASPxColorEdit>
...
<dx:ASPxColorEdit ID="ceBackgroundColor" runat="server" Width="170px">
</dx:ASPxColorEdit>
...
<dx:ASPxColorEdit ID="ceBorderColor" runat="server" Width="170px">
</dx:ASPxColorEdit>
...
<dx:ASPxSpinEdit ID="seBorderWidth" Width="50px" runat="server" MaxValue="10">
</dx:ASPxSpinEdit>
...
<dx:ASPxButton ID="btnApply" CssClass="DemoButton" runat="server" Text="Apply" 
Width="70px" OnClick="btnApply_Click" />

See Also

Captcha Control

ASPxCaptcha Class

ASPxCaptcha Members

DevExpress.Web Namespace