call telerik:RadCaptcha inside CreateUserWizard

2 posts, 0 answers
  1. Charles
    Charles avatar
    5 posts
    Member since:
    Nov 2010

    Posted 16 Nov 2010 Link to this post

    On the following code,

      <asp:CreateUserWizard ID="CreateUserWizard1" runat="server" OnCreatedUser="insertVal" ContinueDestinationPageUrl="~/default.aspx" CreateUserButtonStyle-CssClass="buttonEnable" OnCreatingUser="CreateUserWizard1_CreatingUser" OnCreateUserError="createUserFail">
                <WizardSteps>
                    <asp:CreateUserWizardStep ID="CreateUserWizardStep1" runat="server">
                        <ContentTemplate>
      
                            <table border="0" width=100%>
           <tr><td colspan="3">
            <telerik:RadFormDecorator ID="RadFormDecorator1" runat="server"/>
        <div >
            <table border=0 width=250 height=120>
       
                <tr>
                    <td align=center>
                    <asp:Label ID="lblErrorMessage" runat="server" ForeColor="Red" ></asp:Label>
                        <telerik:RadCaptcha ID="RadCaptcha1" runat="server" ErrorMessage="The code is not valid."
                            ValidationGroup="CreateUserWizard1" ValidatedTextBoxID="rcTextBox1" Display=none>
                            <CaptchaImage  RenderImageOnly="true"  BackgroundColor="white" TextColor="Black" BackgroundNoise="None" />
                        </telerik:RadCaptcha><br />
                        <asp:Label ID="rcLabel1" runat="server" AssociatedControlID="rcTextBox1"><h3>Type the code from the image:</h3></asp:Label>
                         <asp:TextBox ID="rcTextBox1" runat="server" MaxLength="5" Width="170px"></asp:TextBox>
                    </td>
                </tr>
      
            </table>
        </div>
        
        <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
        </telerik:RadScriptBlock>
    ...
    </asp:CreateUserWizard>

    How do you call RadCaptcha1 when it's inside <asp:CreateUserWizard .

    I have tried those but it does not work

    If

     

    Not RadCaptcha1.IsValid Then

     

    ...
    end if

    If Not CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("RadCaptcha1").IsValid Then

     

    ...
    end if

    Thx
    Charles
  2. Pero
    Admin
    Pero avatar
    1156 posts

    Posted 19 Nov 2010 Link to this post

    Hi Charles,

    The FindControl method always returns an object of type Control. You first need to cast the control found by the method to a RadCaptcha control.

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
        Dim captcha As RadCaptcha = DirectCast(CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("RadCaptcha1"), RadCaptcha)
        Page.Title = captcha.CaptchaImage.Text
    End Sub


    All the best,
    Pero
    the Telerik team
    Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Back to Top