IMPORTANT: This version of Sitefinity CMS is out of support and the respective product documentation is no longer maintained and can be outdated. Use the version selector to view a supported product version.
Use this procedure to wire up the created template and the control itself.
To specify a default template for the control, you must override the LayoutTemplatePath property in the Rotator class. It must return a string that represents a reference to the embedded resource that represents your template.
LayoutTemplatePath
Rotator
The LayoutTemplatePath follows the naming convention <Namespace>.<ResourceFolderPath>.<TemplateName>, where you must replace path slashes inside the resource folder path with dots.
<Namespace>.<ResourceFolderPath>.<TemplateName>
The template that you defined uses the RadRotator control for its main UI element. When you implement the features of the control, you will need an instance of that control to pass the news items to it or to set the various properties. You must create a property that returns the instance of the RadRotator control in your template. To use RadRotator control in code, you must import the using Telerik.Web.UI; statement.
The template, you provided, is instantiated inside the Container object, that handles all the logic for managing the template. Use its GetControl<T> method to find the RadRotator1 control. To pass the ID of the control and whether it is required, you must use the third overload of the method. In this case, you require the control's instance, because the controls relies on it. If there is no RadRotator1 control in the provided template the control throws an exception. To avoid this behavior, you can set the required parameter to false.
Container
GetControl<T>
NOTE: When using templates make sure you address the controls after they have been initialized. The place, where the template is initialized and ready to use, is the InitializeControls method. In it and after its execution, you can safely call your controls. You can call the EnsureChildControls() method before every reference to a template control.
InitializeControls
EnsureChildControls()
EXAMPLE: For more information about the Rotator.cs file, see NewsRotator widget: Code of the control class.
Back To Top
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important