1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Creating a Control

Creating a Control

2 posts, 1 answered
  1. Stuart Hemming
    Stuart Hemming avatar
    144 posts
    Registered:
    07 Jul 2004
    15 May 2011
    Link to this post
    I'm working through the examples in the docs for creating a custom control.

    The documentation says ...

    In Sitefinity, you can create your controls as standard ASP.NET custom controls or you can derive them from one of the built-in base classes - SimpleView, SimpleScriptView.

    However, all of the follow documentation assumes that you are, in fact, deriving from SimpleView.

    I would like to know how you proceed if you aren't going to do that. Specifically I want to know how to reference the template I create in my control. The examples suggest writing something like this ...

    protected virtual RadRotator RadRotator1
    {
        get
        {
            return base.Container.GetControl<RadRotator>("RadRotator1", true);
        }
    }

    Except, I believe, Container is a property of SimpleView

    How do I reference my template if I'm not using it?

    -- 
    Stuart
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    16 May 2011
    Link to this post
    Hi Stuart,

    We have a control traverser that loops through controls collection which allows you to reference the control from the template as shown above. If you don't inherit from SimpleView or our controls you need to implement your own way for mapping templates and finding controls. In this case you can inherit from CompositeControl and implement INamingContainer.

    Greetings,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
    Answered
2 posts, 1 answered