Captcha Audio Feature
In order for RadCaptcha to be accessible by sight-impaired users, the control can generate an audio code. To enable this functionality you need to simply set the CaptchaImage-EnableCaptchaAudio property to true. This will cause the link button that retrieves the audio code, to be rendered below the CaptchaImage. To control the visual appearance of the link button, the rcCaptchaAudioLink CSS class should be used. See the help section for detailed information about RadCaptcha's audio functionality.
<%@ Page Language="vb" CodeFile="DefaultVB.aspx.vb" Inherits="Telerik.Web.Examples.Captcha.CaptchaAudioCode.DefaultVB" %><%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %><%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %><%@ Register TagPrefix="qsf" TagName="Header" Src="~/Common/Header.ascx" %><%@ Register TagPrefix="qsf" TagName="HeadTag" Src="~/Common/HeadTag.ascx" %><%@ Register TagPrefix="qsf" TagName="Footer" Src="~/Common/Footer.ascx" %><%@ Register Assembly="System.Web.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System.Web.UI.WebControls" TagPrefix="asp" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <qsf:HeadTag ID="Headtag1" runat="server"></qsf:HeadTag> <style type="text/css"> .divCaptcha { float: left; height: 220px; width: 433px; background-image: url('Images/captcha_back.png'); background-repeat: no-repeat; padding-top: 1px; } .rcCaptchaAudioLink { margin-left: 20px; font-size: 16px; float: left; color: White; display: block; line-height: 1.5em; background-image: url('Images/audio_but.png'); background-repeat: no-repeat; height: 30px; padding-left: 40px; margin-top: 12px; width: 120px; } .rcCaptchaAudioLink:hover { color: #F0F0F0; } .rcCaptchaImage { float: left; } .qsfPanel { float: right; } .errorMessage { margin-left: 30px; line-height: 20px; } </style></head><body class="BODY"> <form id="form1" runat="server"> <qsf:Header ID="Header1" runat="server" NavigationLanguage="VB" ShowSkinChooser="false" /> <telerik:RadScriptManager ID="RadScriptManager1" runat="server"> </telerik:RadScriptManager> <telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" DecoratedControls="All" Skin="Hay" /> <div class="divCaptcha"> <table> <tr> <td style="height: 20px;"> <asp:Label ID="lblErrorMessage" runat="server" ForeColor="Red" CssClass="errorMessage"></asp:Label> </td> </tr> <tr> <td style="width: 100%; text-align: center; padding-left: 30px; padding-top: 3px;"> <telerik:RadCaptcha ID="RadCaptcha1" runat="server" ErrorMessage="Page not valid. The code you entered is not valid." ValidationGroup="vgAudio" ValidatedTextBoxID="rcTextBox1" Display="None"> <CaptchaImage EnableCaptchaAudio="true" RenderImageOnly="true" ImageCssClass="rcCaptchaImage" BackgroundColor="#609f0a" TextColor="White" BackgroundNoise="None" /> </telerik:RadCaptcha> </td> </tr> <tr> <td style="padding-left: 100px; padding-top: 10px;"> <br /> <asp:Label ID="rcLabel1" runat="server" AssociatedControlID="rcTextBox1" Text="Type the code from the image:" ForeColor="#005000"></asp:Label> <br /> <asp:TextBox ID="rcTextBox1" runat="server" MaxLength="5" Width="170px"></asp:TextBox> <asp:Button ID="Button1" runat="server" ValidationGroup="vgAudio" Text="Submit" OnClick="Button1_Click" /> </td> </tr> </table> </div> <qsf:ConfiguratorPanel runat="server" ID="ConfigurationPanel1" Title="Configure Example" Expanded="true" Width="400px" CssClass="qsfPanel"> <div style="padding-left: 40px;"> <asp:CheckBox ID="cbEnableCaptchaAudio" runat="server" Text="Enable CaptchaAudio Code Functionality" AutoPostBack="true" OnCheckedChanged="EnableRefreshCaptchaImage" /> <br /> <br /> <br /> <label for="txtGetAudioCode">Set the text to the CaptchaAudio LinkButton:</label> <br /> <asp:TextBox ID="txtGetAudioCode" runat="server"></asp:TextBox> <br /> <br /> <asp:Button ID="btnAudioCode" runat="server" Text="Set" OnClick="btnAudioCode_Click" CausesValidation="false" /> </div> </qsf:ConfiguratorPanel> <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server"> <script type="text/javascript"> //<![CDATA[ function pageLoad() { var captchaTextBox = document.getElementById("<%= rcTextBox1.ClientID %>"); captchaTextBox.setAttribute("autocomplete", "off"); } //]]> </script> </telerik:RadScriptBlock> <qsf:Footer runat="server" ID="Footer1" ShowCodeViewer="true" /> </form></body></html>
Take your time to truly experience the power of RadControls for ASP.NET AJAX with a free 60-day trial backed up by Telerik’s unlimited dedicated support.
Download your RadControls for ASP.NET AJAX trial and jumpstart your development with the available Getting Started resources.
If you have any questions, do not hesitate to contact us at sales@telerik.com.