Back to Devexpress

ASPxCaptcha.ClientSideEvents Property

aspnet-devexpress-dot-web-dot-aspxcaptcha-2de8a4fd.md

latest4.1 KB
Original Source

ASPxCaptcha.ClientSideEvents Property

Gets an object that lists the client-side events specific to the ASPxCaptcha.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
public CallbackClientSideEventsBase ClientSideEvents { get; }
vb
Public ReadOnly Property ClientSideEvents As CallbackClientSideEventsBase

Property Value

TypeDescription
CallbackClientSideEventsBase

An object that allows you to handle ASPxCaptcha‘s client-side events.

|

Remarks

The ClientSideEvents property provides access to an object of the CallbackClientSideEventsBase type. This object contains properties whose names correspond to the events available to the ASPxCaptcha on the client side. These properties provide the capability to assign handling JavaScript functions to the required client-side events of the ASPxCaptcha control.

Example

The following part of the ASPxCaptcha - Custom Appearance online demo illustrates how to implement a captcha control with a custom appearance.

In this example, the control’s Refresh Button.ASPxCaptcha and Text Box.ASPxCaptcha are hidden, and their functionaliry is implemented in a custom manner using separate controls (the IMG element, ASPxLabel, ASPxTextBox).

javascript
function GetRefreshButton() {
    return document.getElementById("refreshButton");
}        

function OnCaptchaBeginCallback(s, e) {
    var refreshButton = GetRefreshButton();
    refreshButton.src = "Images/refreshButtonAnimated.gif";
}

function OnCaptchaEndCallback(s, e) {
    var refreshButton = GetRefreshButton();
    refreshButton.src = "Images/refreshButton.gif"; 
    tbCode.SetValue("");
...   
}
aspx

...
<dx:ASPxCaptcha ID="Captcha" runat="server" SkinID="dummy" ClientInstanceName="captcha" 
CodeLength="6">
    <ChallengeImage BackgroundColor="Transparent" ForegroundColor="#676767" BorderWidth="0"
        Height="72" />
    <ValidationSettings EnableValidation="False">
    </ValidationSettings>
    <TextBox Visible="False" />
    <RefreshButton Visible="False">
    </RefreshButton>
    <LoadingPanel Enabled="False" />
    <ClientSideEvents BeginCallback="OnCaptchaBeginCallback" 
        EndCallback="OnCaptchaEndCallback" />
</dx:ASPxCaptcha>
...
<dx:ASPxLabel ID="lblCode" runat="server" AssociatedControlID="tbCode" Text="Type the code">
</dx:ASPxLabel>
...
<dx:ASPxTextBox ID="tbCode" runat="server" Width="200px" AutoCompleteType="Disabled"
    BackColor="Transparent" ClientInstanceName="tbCode">
    <Border BorderWidth="0px" />
</dx:ASPxTextBox>
...
<dx:ASPxButton ID="btnSubmit" runat="server" Text="Submit" UseSubmitBehavior="true"
    AutoPostBack="true" Width="175px">
</dx:ASPxButton>

See Also

Client-Side Events

Captcha Control

ASPxCaptcha Class

ASPxCaptcha Members

DevExpress.Web Namespace