New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial

RadRotator Control

Definition

Namespace:Telerik.Web.UI

Assembly:Telerik.Web.UI.dll

Syntax:

C#
[RequiredScript(typeof(AnimationScripts))]
[RequiredScript(typeof(MaterialRipple))]
[RequiredScript(typeof(IETouchActionManager))]
[ClientScriptResource("Telerik.Web.UI.RadRotator", "Telerik.Web.UI.Common.Navigation.NavigationScripts.js")]
[ClientScriptResource("Telerik.Web.UI.RadRotator", "Telerik.Web.UI.Rotator.RadRotator.js")]
[TelerikToolboxCategory("Visualization")]
[ToolboxBitmap(typeof(RadRotator), "Toolbox.Icons.Rotator.png")]
[EmbeddedSkin("Rotator")]
[EmbeddedSkin("Rotator", "Default")]
[RequiredCss("Telerik.Web.UI.Skins.Common.fonticons.css", RenderMode.Lightweight, typeof(RadRotator))]
[RequiredCss("Telerik.Web.UI.Skins.Common.MaterialRipple.css", RenderMode.Lightweight, typeof(RadButton))]
public class RadRotator : RadDataBoundControl, IComponent, IDisposable, IParserAccessor, IUrlResolutionService, IDataBindingsAccessor, IControlBuilderAccessor, IControlDesignerAccessor, IExpressionsAccessor, IAttributeAccessor, IScriptControl, IControlResolver, IPostBackDataHandler, ISkinnableControl, IControl, IFeatureGroup, IPostBackEventHandler, INamingContainer

Inheritance: objectControlWebControlBaseDataBoundControlDataBoundControlRadDataBoundControlRadRotator...

Implements: IAttributeAccessorIComponentIControlIControlBuilderAccessorIControlDesignerAccessorIControlResolverIDataBindingsAccessorIDisposableIExpressionsAccessorIFeatureGroupINamingContainerIParserAccessorIPostBackDataHandlerIPostBackEventHandlerIScriptControlISkinnableControlIUrlResolutionService...

Inherited Members DataBoundControl.OnCreatingModelDataSource(CreatingModelDataSourceEventArgs)DataBoundControl.CreateDataSourceSelectArguments()DataBoundControl.GetData()DataBoundControl.GetDataSource()DataBoundControl.MarkAsDataBound()DataBoundControl.OnDataPropertyChanged()DataBoundControl.OnDataSourceViewChanged(object, EventArgs)DataBoundControl.OnLoad(EventArgs)DataBoundControl.OnPagePreLoad(object, EventArgs)DataBoundControl.PerformSelect()DataBoundControl.ValidateDataSource(object)DataBoundControl.DataMemberDataBoundControl.IsUsingModelBindersDataBoundControl.ItemTypeDataBoundControl.SelectMethodDataBoundControl.DataSourceIDDataBoundControl.DataSourceObjectDataBoundControl.SelectArgumentsDataBoundControl.CreatingModelDataSourceDataBoundControl.CallingDataMethodsBaseDataBoundControl.ConfirmInitState()BaseDataBoundControl.DataBind()BaseDataBoundControl.EnsureDataBound()BaseDataBoundControl.OnDataBound(EventArgs)BaseDataBoundControl.OnInit(EventArgs)BaseDataBoundControl.OnPreRender(EventArgs)BaseDataBoundControl.DataSourceBaseDataBoundControl.InitializedBaseDataBoundControl.IsBoundUsingDataSourceIDBaseDataBoundControl.IsDataBindingAutomaticBaseDataBoundControl.SupportsDisabledAttributeBaseDataBoundControl.RequiresDataBindingBaseDataBoundControl.DataBoundWebControl.AddAttributesToRender(HtmlTextWriter)WebControl.ApplyStyle(Style)WebControl.CopyBaseAttributes(WebControl)WebControl.CreateControlStyle()WebControl.MergeStyle(Style)WebControl.Render(HtmlTextWriter)WebControl.RenderBeginTag(HtmlTextWriter)WebControl.RenderEndTag(HtmlTextWriter)WebControl.AccessKeyWebControl.AttributesWebControl.BackColorWebControl.BorderColorWebControl.BorderWidthWebControl.BorderStyleWebControl.ControlStyleWebControl.ControlStyleCreatedWebControl.CssClassWebControl.DisabledCssClassWebControl.StyleWebControl.EnabledWebControl.EnableThemingWebControl.FontWebControl.ForeColorWebControl.HasAttributesWebControl.IsEnabledWebControl.SkinIDWebControl.TabIndexWebControl.TagNameWebControl.ToolTipControl.ResolveAdapter()Control.HasEvents()Control.GetRouteUrl(object)Control.GetRouteUrl(string, object)Control.GetRouteUrl(RouteValueDictionary)Control.GetRouteUrl(string, RouteValueDictionary)Control.GetUniqueIDRelativeTo(Control)Control.ApplyStyleSheetSkin(Page)Control.OnDataBinding(EventArgs)Control.DataBind(bool)Control.DataBindChildren()Control.AddParsedSubObject(object)Control.EnsureID()Control.ClearChildState()Control.ClearChildControlState()Control.ClearChildViewState()Control.ClearEffectiveClientIDMode()Control.ClearCachedClientID()Control.Focus()Control.LoadControlState(object)Control.MapPathSecure(string)Control.OpenFile(string)Control.BuildProfileTree(string, bool)Control.SaveControlState()Control.RenderChildren(HtmlTextWriter)Control.RenderControl(HtmlTextWriter)Control.RenderControl(HtmlTextWriter, ControlAdapter)Control.OnUnload(EventArgs)Control.Dispose()Control.RaiseBubbleEvent(object, EventArgs)Control.OnBubbleEvent(object, EventArgs)Control.AddedControl(Control, int)Control.CreateControlCollection()Control.CreateChildControls()Control.ResolveUrl(string)Control.ResolveClientUrl(string)Control.FindControl(string)Control.FindControl(string, int)Control.GetDesignModeState()Control.HasControls()Control.IsLiteralContent()Control.EnsureChildControls()Control.RemovedControl(Control)Control.SetDesignModeState(IDictionary)Control.SetRenderMethodDelegate(RenderMethod)Control.ClientIDModeControl.ClientIDControl.ClientIDSeparatorControl.ContextControl.AdapterControl.DesignModeControl.EventsControl.IDControl.IsChildControlStateClearedControl.EnableViewStateControl.ViewStateModeControl.IsViewStateEnabledControl.NamingContainerControl.IdSeparatorControl.LoadViewStateByIDControl.PageControl.RenderingCompatibilityControl.TemplateControlControl.ParentControl.TemplateSourceDirectoryControl.AppRelativeTemplateSourceDirectoryControl.SiteControl.VisibleControl.UniqueIDControl.HasChildViewStateControl.ControlsControl.ValidateRequestModeControl.ViewStateControl.ViewStateIgnoresCaseControl.ChildControlsCreatedControl.IsTrackingViewStateControl.DisposedControl.DataBindingControl.InitControl.LoadControl.PreRenderControl.Unloadobject.ToString()object.Equals(object)object.Equals(object, object)object.ReferenceEquals(object, object)object.GetHashCode()object.GetType()object.MemberwiseClone()...

Constructors

C#
public RadRotator()

Properties

Specifies whether the Rotator items created on the client-side should be cleared before data binding.

C#
[ClientControlProperty]
public bool AppendClientDataBoundItems { get; set; }
C#
public bool AppendDataBoundItems { get; set; }

Gets or sets a value indicating whether a postback to the server automatically occurs when the user interacts with the control.

C#
public virtual bool AutoPostBack { get; set; }
Property Value:

The default value is false.

Setting this property to true will make Telerik RadRotator postback to the server on item click.

Gets or sets the virtual path where the rotator will look for ads/banners (images) to play. This property basically enables the Ad mode of the Rotator. The default value is string.Empty.

C#
public string BannersPath { get; set; }
Property Value:

The default value is an empty string.

Gets or sets the HTML template that will be used when the Rotator is databound to ClientDataSource.

C#
[PersistenceMode(PersistenceMode.InnerProperty)]
public virtual string ClientTemplate { get; set; }
C#
[PersistenceMode(PersistenceMode.InnerProperty)]
public RotatorControlButtonsConfiguration ControlButtons { get; }

The CssClass property will now be used instead of the former Skin and will be modified in AddAttributesToRender()

C#
protected override string CssClassFormatString { get; }

Overrides: RadDataBoundControl.CssClassFormatString

Example:
C#
protected override string CssClassFormatString
{
       get
       {
           return "RadDock RadDock_{0} rdWTitle rdWFooter";
       }
}

Gets or sets a flag determining if drag-scrolling should be enabled.

C#
[ClientControlProperty]
public bool EnableDragScrolling { get; set; }
Property Value:

The default value is false. This means the drag-scrolling is not enabled.

Gets or sets a value indicating whether to randomize the order of display for the rotator items.

C#
[ClientControlProperty]
public bool EnableRandomOrder { get; set; }
Property Value:

The default value is false. This means the items will be displayed in the order they appear in the datasource.

Specifies the time in milliseconds each frame will display in automatic scrolling scenarios.

C#
[ClientControlProperty]
public int FrameDuration { get; set; }
Property Value:

Default: 2000

Gets or sets the height of the Web server control. The default height is 200 pixels.

C#
public override Unit Height { get; set; }

Overrides: RadDataBoundControl.Height

Specifies the index of the item, which will be shown first when the rotator loads. When set to 0 (default) - positions initial item to be visible in the rotator. When set to -1 - positions the initial item just outside of the rotator viewport. Any other positive value - the rotator starts with that particular item in the viewport.

C#
[ClientControlProperty]
public int InitialItemIndex { get; set; }
Property Value:

Default: 0

Specifies the default rotator item height.

C#
public Unit ItemHeight { get; set; }
Property Value:

Default: Unit.Empty

C#
[PersistenceMode(PersistenceMode.InnerProperty)]
[Browsable(false)]
public RadRotatorItemCollection Items { get; }
C#
[TemplateContainer(typeof(RadRotatorItem))]
[PersistenceMode(PersistenceMode.InnerProperty)]
[Browsable(false)]
[Bindable(false)]
public ITemplate ItemTemplate { get; set; }

Specifies the default rotator item width.

C#
public Unit ItemWidth { get; set; }
Property Value:

Default: Unit.Empty

Gets or sets the name of the JavaScript function that will be called when the Rotator is databound on the client-side.

C#
[ClientControlEvent]
[ClientPropertyName("dataBound")]
public string OnClientDataBound { get; set; }

The name of the javascript function called after an item is clicked.

C#
[ClientControlEvent]
[ClientPropertyName("itemClicked")]
public string OnClientItemClicked { get; set; }

The name of the javascript function called when an item is clicked.

C#
[ClientControlEvent]
[ClientPropertyName("itemClicking")]
public string OnClientItemClicking { get; set; }

Gets or sets the name of the JavaScript function that will be called when an item is databound on the client-side.

C#
[ClientControlEvent]
[ClientPropertyName("itemDataBound")]
public string OnClientItemDataBound { get; set; }

The name of the javascript function called when an item is about to be shown.

C#
[ClientControlEvent]
[ClientPropertyName("itemShowing")]
public string OnClientItemShowing { get; set; }

The name of the javascript function called after an item has been shown.

C#
[ClientControlEvent]
[ClientPropertyName("itemShown")]
public string OnClientItemShown { get; set; }

Gets or sets a value indicating the client-side event handler that is called when the RadRotator items were just populated when load on demand(from web service).

C#
[Bindable(false)]
[ClientControlEvent]
[ClientPropertyName("itemsRequested")]
public string OnClientItemsRequested { get; set; }

Gets or sets a value indicating the client-side event handler that is called when the operation for populating the RadRotator when load on demand has failed.

C#
[Bindable(false)]
[ClientControlEvent]
[ClientPropertyName("itemsRequestFailed")]
public string OnClientItemsRequestFailed { get; set; }

Gets or sets a value indicating the client-side event handler that is called when the RadRotator items are about to be populated when load on demand(from web service).The event is cancellable

C#
[Bindable(false)]
[ClientControlEvent]
[ClientPropertyName("itemsRequesting")]
public string OnClientItemsRequesting { get; set; }

The name of the javascript function called when the rotator is loaded on the client. The function is called right before the automatic animation (if used) begins.

C#
[ClientControlEvent]
[ClientPropertyName("load")]
public string OnClientLoad { get; set; }

The name of the javascript function called after the mouse leaves an item.

C#
[ClientControlEvent]
[ClientPropertyName("mouseOut")]
public string OnClientMouseOut { get; set; }

The name of the javascript function called when the mouse hovers over an item.

C#
[ClientControlEvent]
[ClientPropertyName("mouseOver")]
public string OnClientMouseOver { get; set; }

Gets or sets the name of the JavaScript function called when the client template for an item is evaluated.

C#
[ClientControlEvent]
[ClientPropertyName("templateDataBound")]
public string OnClientTemplateDataBound { get; set; }

Gets or sets a value indicating whether to pause the rotator scrolling when the mouse is over a roatator item

C#
[ClientControlProperty]
public bool PauseOnMouseOver { get; set; }
Property Value:

The default value is true. This means the animation will be paused when the user hovers over a rotator item.

Gets or sets a value indicating whether the index of current item is persisted between postbacks.

C#
[Bindable(false)]
[ClientControlProperty]
public bool PersistCurrentItemOnPostBack { get; set; }
C#
[Themeable(false)]
public string PostBackUrl { get; set; }

Specifies the type of rotator [how the rotator will render and what options the user will have for interacting with it on the client] RotatorType

C#
[ClientControlProperty]
public RotatorType RotatorType { get; set; }
Property Value:

Default: RotatorType.Buttons

Specifies possible directions for scrolling rotator items. RotatorScrollDirection

C#
[ClientControlProperty]
public RotatorScrollDirection ScrollDirection { get; set; }
Property Value:

Default: RotatorScrollDirection.Left | RotatorScrollDirection.Right

Specifies the speed in milliseconds for scrolling rotator items.

C#
[ClientControlProperty]
public int ScrollDuration { get; set; }
Property Value:

Default: 500

C#
[PersistenceMode(PersistenceMode.InnerProperty)]
public AnimationSettings SlideShowAnimation { get; }
C#
protected override bool SupportsRenderingMode { get; }

Overrides: RadDataBoundControl.SupportsRenderingMode

C#
protected override HtmlTextWriterTag TagKey { get; }

Overrides: WebControl.TagKey

Gets the settings for the web service used to populate items

C#
[PersistenceMode(PersistenceMode.InnerProperty)]
public WebServiceSettings WebServiceSettings { get; }
Property Value:

An WebServiceSettings that represents the web service used for populating items.

Use the WebServiceSettings property to configure the web service used to populate items on demand. You must specify both Path and Method to fully describe the service.

In order to use the integrated support, the web service should have the following signature:

   <pre><code class="lang-csharp">[ScriptService]

public class WebServiceName : WebService { [WebMethod] public RadRotatorItemData[] WebServiceMethodName(int itemIndex, int itemCount) { List<RadRotatorItemData> result = new List<RadRotatorItemData>(); RadRotatorItemData item; for (int i = 0; i < itemCount; i++) { item = new RadRotatorItemData(); item.Html = "test "+(itemIndex+i); result.Add(item); } return result.ToArray(); } }

Gets or sets the width of the Web server control. The default width is 200 pixels.

C#
public override Unit Width { get; set; }

Overrides: RadDataBoundControl.Width

C#
[ClientControlProperty]
public bool WrapFrames { get; set; }

Methods

Binds the RadRotator to the collection of images found in the provided BannersPath. If no path is provided the Rotator will use the data source provided.

C#
public void BindToBanners(bool forceBind = false)
Parameters:forceBindbool

Forces the rotator to request the images from the specified location.

This method is called by the RadRotator on PreRender. Therefore you don't have to call it unless you want to explicitly force the rotator to request its items.

Binds the rotator to a IEnumerable data source

C#
public void BindToEnumerableData(IEnumerable dataSource)
Parameters:dataSourceIEnumerable

IEnumerable data source

Code moved into this method from OnPreRender to make sure it executed when the framework skips OnPreRender() for some reason

C#
protected override void ControlPreRender()

Overrides: RadDataBoundControl.ControlPreRender()

C#
protected override void DescribeComponent(IScriptDescriptor descriptor)
Parameters:descriptorIScriptDescriptor

Overrides: RadDataBoundControl.DescribeComponent(IScriptDescriptor)

C#
protected virtual RadRotatorItem FindItemByHierarchicalIndex(string hierarchicalIndex)
Parameters:hierarchicalIndexstringReturns:

RadRotatorItem

Gets all the images (used as banners/ads) from the specified folder.

C#
protected virtual List<BannerDataItem> GetBanners(string virtualPath, string allowedExtensions)
Parameters:virtualPathstring

The virtual path to the folder where the images will be taken.

allowedExtensionsstring

The string of comma-separated allowed image extensions.

Returns:

List<BannerDataItem>

Collection of all the images in the specified folder.

Gets a string of comma-separated allowed image extensions when the rotator searches the BannersPath for image files.

C#
protected virtual string GetImageExtensions()
Returns:

string

The string of comma-separated allowed image extensions. The default allowed extensions are: ".jpg,.jpeg,.gif,.png,*.bmp,".

C#
protected virtual string GetPostbackEventReference()
Returns:

string

C#
protected virtual void InitializeItem(RadRotatorItem item)
Parameters:itemRadRotatorItem

Executed when post data is loaded from the request

C#
protected override bool LoadPostData(string postDataKey, NameValueCollection postCollection)
Parameters:postDataKeystringpostCollectionNameValueCollectionReturns:

bool

Overrides: RadDataBoundControl.LoadPostData(string, NameValueCollection)

C#
protected override void LoadViewState(object savedState)
Parameters:savedStateobject

Overrides: DataBoundControl.LoadViewState(object)

C#
protected virtual void OnItemClick(RadRotatorItem item)
Parameters:itemRadRotatorItem
C#
protected virtual void OnItemCreated(RadRotatorItem item)
Parameters:itemRadRotatorItem
C#
protected virtual void OnItemDataBound(RadRotatorItem item)
Parameters:itemRadRotatorItem
C#
protected override void PerformDataBinding(IEnumerable data)
Parameters:dataIEnumerable

Overrides: DataBoundControl.PerformDataBinding(IEnumerable)

C#
protected void PrepareForDataBinding()
C#
protected virtual void RaisePostBackEvent(string itemIndex)
Parameters:itemIndexstring
C#
protected void RaiseRotatorItemEvent(RadRotatorItem item, object eventKey)
Parameters:itemRadRotatorItemeventKeyobject
C#
protected override void RenderContents(HtmlTextWriter writer)
Parameters:writerHtmlTextWriter

Overrides: RadDataBoundControl.RenderContents(HtmlTextWriter)

C#
protected override object SaveViewState()
Returns:

object

Overrides: DataBoundControl.SaveViewState()

C#
protected override void TrackViewState()

Overrides: DataBoundControl.TrackViewState()

Events

C#
public event RadRotatorEventHandler ItemClick
C#
public event RadRotatorEventHandler ItemCreated
C#
public event RadRotatorEventHandler ItemDataBound