More in this section

Forums / Developing with Sitefinity / Exposing Complex Child Controls as Properties for Captcha control

Exposing Complex Child Controls as Properties for Captcha control

4 posts, 1 answered
  1. Bazmech
    Bazmech avatar
    2 posts
    Registered:
    26 Jun 2006
    09 Sep 2009
    Link to this post
    I am creating a form control and have a Captcha control within it.
    I am exposing the Captcha control as a property so that all the variables can be edited once in Sitefinity admin. When I edit the control I can see CaptureImage property, my name for it, and it has an Edit button next to it, so far so good. Clicking on this opens up all the properties within the Captcha control but under Captcha category the CaptchaImage property simply has a text box with 'Telerik.Web.UI.CaptchaImage' within it with no Edit button next to it.

    For some reason the CaptchaImage object is not being loaded so I was wondering if I need a reference either in my custom control or web.config.

    I simply have a Captcha control in the HTML and the following code in the code behind,

    [Category("Form Settings")] 
    public Telerik.Web.UI.RadCaptcha CaptureImage 
        get { return rcInformationPack; } 

    Any help in resolving this would be gratefully received
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    09 Sep 2009
    Link to this post
    Hello Bazmech,

    The Telerik.Web.UI.CaptchaImage does not have edit button next to it because it currently does not have a setter implemented - unlike the captcha control for which you get the edit control. What you can do in this case is to expose all properties of the Telerik.Web.UI.CaptchaImage in a your custom section for the user control. Consider the following example:

    [Category("Captha Image Settings")] 
    public Telerik.Web.UI.CaptchaBackgroundNoiseLevel BackGroundNoiseLevel 
       get { return this.Captcha.CaptchaImage.BackgroundNoise; } 
       set { this.Captcha.CaptchaImage.BackgroundNoise = value; } 

    This should do the trick. If you have more questions, please feel free to contact us.

    All the best,
    Radoslav Georgiev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Answered
  3. Bazmech
    Bazmech avatar
    2 posts
    Registered:
    26 Jun 2006
    14 Sep 2009
    Link to this post
    Thank you for letting me know that the control does not currently support this usage.

    I was trying to avoid creating individual properties for each attribute but for the time being I will use this method.

    If I find this happening again in the future can I assume that it is the same problem as it should be a as simple as exposing the control to gain access to all attributes and objects?

    Thank you for your help.
  4. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    14 Sep 2009
    Link to this post
    Hi Bazmech,

    You are on the right track. As long as the properties for such controls have exposed set method it is as easy as in the sample to make these properties configurable from the control designer. Since the RadCaptcha is a new control, I guess that in future releases there would be a set method for the CaptchaImage, which would save some exposing of properties.

    All the best,
    Radoslav Georgiev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Register for webinar
4 posts, 1 answered