This is a migrated thread and some comments may be shown as answers.

call telerik:RadCaptcha inside CreateUserWizard

1 Answer 39 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Charles
Top achievements
Rank 1
Charles asked on 16 Nov 2010, 03:55 PM
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

1 Answer, 1 is accepted

Sort by
0
Pero
Telerik team
answered on 19 Nov 2010, 08:50 AM
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.
Tags
General Discussions
Asked by
Charles
Top achievements
Rank 1
Answers by
Pero
Telerik team
Share this question
or