Creating a Control

Posted by Community Admin on 03-Aug-2018 01:11

Creating a Control

All Replies

Posted by Community Admin on 15-May-2011 00:00

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

Posted by Community Admin on 16-May-2011 00:00

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

This thread is closed