Skip to main content
Tab

ASPxCaptcha.CodeLength Property

Gets or sets the code length displayed within the editor’s challenge image.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.1.dll

NuGet Package: DevExpress.Web

Declaration

[DefaultValue(5)]
public int CodeLength { get; set; }

Property Value

Type Default Description
Int32 5

An integer value that represents the displayed code length.

Example

The following part of the ASPxCaptcha - Features online demo illustrates how to customize the characters set used to generate the challenge image’s code (ASPxCaptcha.CharacterSet) and specify this code length (ASPxCaptcha.CodeLength).

This settings are specified within a panel (ASPxTextBox, ASPxSpinEdit editors) and applied to the captcha control via the Apply button (ASPxButton).

protected void btnApply_Click(object sender, EventArgs e) {
...
    int parseResult = 0;
    if(tbCharacterSet.IsValid)
        Captcha.CharacterSet = tbCharacterSet.Text;
    if (int.TryParse(seCodeLength.Text, out parseResult))
        Captcha.CodeLength = parseResult;
...
}
See Also