RadSlider
Telerik RadSlider is a flexible UI component that allows users to select a value from a defined range using a smooth or step-based slider.
Definition
Namespace:Telerik.Web.UI
Assembly:Telerik.Web.UI.dll
Syntax:
[RequiredScript(typeof(jQueryPlugins))]
[RequiredScript(typeof(ResizeExtender))]
[RequiredScript(typeof(AnimationFramework))]
[RequiredScript(typeof(MaterialRipple))]
[ClientScriptResource("Telerik.Web.UI.RadSlider", "Telerik.Web.UI.Slider.RadSliderScripts.js")]
[EmbeddedSkin("Slider")]
[EmbeddedSkin("Slider", "Default")]
[RequiredCss("Telerik.Web.UI.Skins.Common.fonticons.css", RenderMode.Lightweight, typeof(RadSlider))]
[RequiredCss("Telerik.Web.UI.Skins.Common.MaterialRipple.css", RenderMode.Lightweight, typeof(RadButton))]
[TelerikToolboxCategory("Miscellaneous")]
[ToolboxBitmap(typeof(RadSlider), "Toolbox.Icons.Slider.png")]
public class RadSlider : ControlItemContainer, IComponent, IDisposable, IParserAccessor, IUrlResolutionService, IDataBindingsAccessor, IControlBuilderAccessor, IControlDesignerAccessor, IExpressionsAccessor, IAttributeAccessor, IScriptControl, IControlResolver, IPostBackDataHandler, ISkinnableControl, IControl, IFeatureGroup, INamingContainer, IXmlSerializable, IControlItemContainer, IPostBackEventHandler
Inheritance: objectControlWebControlBaseDataBoundControlDataBoundControlRadDataBoundControlControlItemContainerRadSlider...
Implements:
Inherited Members
Constructors
public RadSlider()
Properties
Get/Set the length of the animation
[ClientControlProperty]
public int AnimationDuration { get; set; }
Gets/Sets a value indicating whether the DataBound items should be appended to the Slider Items collection, or the collection should be cleared before creating the DataBound items.
public override bool AppendDataBoundItems { get; set; }
Overrides:
True to cause a postback on value change.
[ClientControlProperty]
[ClientPropertyName("_autoPostBack")]
public bool AutoPostBack { get; set; }
The CssClass property will now be used instead of the former Skin and will be modified in AddAttributesToRender()
protected override string CssClassFormatString { get; }
Overrides:
Gets or sets the value of RadSlider in a database-friendly way.
[Browsable(false)]
[TypeConverter(typeof(DecimalConverter))]
[Bindable(true, BindingDirection.TwoWay)]
public object DbValue { get; set; }
A decimal object that represents the value. The default value is 0m.
This property behaves exactly as the Value property. The only difference is that it will not throw an exception if the new value is null or DBNull. Setting a null value will revert the selected value to 0m.
Gets or sets the text for the decrease handle
[ClientControlProperty]
[ClientPropertyName("_decreaseText")]
public string DecreaseText { get; set; }
Gets or sets the text for the increase handle
[ClientControlProperty]
[ClientPropertyName("_dragText")]
public string DragText { get; set; }
Get/Set the EnableDragRange of the slider
[ClientControlProperty]
public bool EnableDragRange { get; set; }
Gets or sets a value, indicating whether the HTML of the control will be output from the server or created with client-side code.
[ClientControlProperty]
[ClientPropertyName("_enableServerSideRendering")]
public bool EnableServerSideRendering { get; set; }
Get/Set the Height of the slider including the decrease and increase handles.
[ClientControlProperty]
[ClientPropertyName("_height")]
public override Unit Height { get; set; }
Overrides:
Gets or sets the text for the increase handle
[ClientControlProperty]
[ClientPropertyName("_increaseText")]
public string IncreaseText { get; set; }
Get/Set the IsDirectionReversed of the slider
[ClientControlProperty]
public bool IsDirectionReversed { get; set; }
Get/Set the IsSelectionRangeEnabled of the slider
[ClientControlProperty]
public bool IsSelectionRangeEnabled { get; set; }
Gets the object through which the user should provide the binding information about the slider items.
[PersistenceMode(PersistenceMode.InnerProperty)]
public SliderItemBinding ItemBinding { get; }
Gets a RadSliderItemCollection object that contains the items of the current RadSlider control.
[PersistenceMode(PersistenceMode.InnerProperty)]
public RadSliderItemCollection Items { get; }
A RadSliderItemCollection that contains the items of the current RadSlider control. By default the collection is empty (RadSlider is a numeric slider).
Use the Items property to access the child items of RadSlider You can add, remove or modify items from the Items collection.
Get/Set the ItemType of the slider items
[ClientControlProperty]
public SliderItemType ItemType { get; set; }
Get/Set the delta with which the value will change when user click on the track
public decimal LargeChange { get; set; }
Get/Set the length of the slider including the decrease and increase handles.
[Browsable(false)]
[Obsolete("Please use the Width and Height properties of the RadSlider.")]
public int Length { get; set; }
If the slider is horizontal the width will be set, otherwise the height will be set.
Get/Set the LiveDrag of the slider
[ClientControlProperty]
public bool LiveDrag { get; set; }
Get/Set the max value of the slider
public decimal MaximumValue { get; set; }
Get/Set the min value of the slider
public decimal MinimumValue { get; set; }
[Browsable(false)]
[Obsolete("This property is now obsolete. Please use the OnClientValueChanging property instead.", false)]
public virtual string OnClientBeforeValueChange { get; set; }
Gets or sets a value indicating the client-side event handler that is called after the Slider is databound.
[ClientControlEvent]
[ClientPropertyName("dataBound")]
public virtual string OnClientDataBound { get; set; }
A string specifying the name of the JavaScript function that will handle the event. The default value is empty string.
If specified, the OnClientDataBound client-side event handler is called after the Slider is databound. Two parameters are passed to the handler:
- sender, the RadSlider object.
- args.
This event cannot be cancelled.
Gets or sets a value indicating the client-side event handler that is called before a Slider item is databound.
[ClientControlEvent]
[ClientPropertyName("itemDataBinding")]
public virtual string OnClientItemDataBinding { get; set; }
A string specifying the name of the JavaScript function that will handle the event. The default value is empty string.
If specified, the OnClientItemDataBinding client-side event handler is called before a Slider item is databound. Two parameters are passed to the handler:
- sender, the RadSlider object.
- args.
This event can be cancelled.
Gets or sets a value indicating the client-side event handler that is called after a Slider item is databound.
[ClientControlEvent]
[ClientPropertyName("itemDataBound")]
public virtual string OnClientItemDataBound { get; set; }
A string specifying the name of the JavaScript function that will handle the event. The default value is empty string.
If specified, the OnClientItemDataBound client-side event handler is called after a Slider item is databound. Two parameters are passed to the handler:
- sender, the RadSlider object.
- args.
This event cannot be cancelled.
Gets or sets a value indicating the client-side event handler that is called when the items of the RadSlider control are created.
[ClientControlEvent]
[ClientPropertyName("itemsCreated")]
public virtual string OnClientItemsCreated { get; set; }
A string specifying the name of the JavaScript function that will handle the event. The default value is empty string.
Two parameters are passed to the handler:
- sender, the RadSlider object.
- args.
This event cannot be cancelled.
Gets or sets a value indicating the client-side event handler that is called when the RadSlider control is initialized.
[ClientControlEvent]
[ClientPropertyName("load")]
public virtual string OnClientLoad { get; set; }
A string specifying the name of the JavaScript function that will handle the event. The default value is empty string.
Two parameters are passed to the handler:
- sender, the RadSlider object.
- args.
This event cannot be cancelled.
[Browsable(false)]
[Obsolete("This property is now obsolete. Please use the OnClientLoad property instead.", false)]
public virtual string OnClientLoaded { get; set; }
Gets or sets a value indicating the client-side event handler that is called while the handle is being slided.
[ClientControlEvent]
[ClientPropertyName("slide")]
public virtual string OnClientSlide { get; set; }
A string specifying the name of the JavaScript function that will handle the event. The default value is empty string.
If specified, the OnClientSlide client-side event handler that is called while the handle is being slided. Two parameters are passed to the handler:
- sender, the RadSlider object.
- args.
This event cannot be cancelled.
Gets or sets a value indicating the client-side event handler that is called when slide has ended.
[ClientControlEvent]
[ClientPropertyName("slideEnd")]
public virtual string OnClientSlideEnd { get; set; }
A string specifying the name of the JavaScript function that will handle the event. The default value is empty string.
If specified, the OnClientSlideEnd client-side event handler that is called when slide has ended. Two parameters are passed to the handler:
- sender, the RadSlider object.
- args.
This event cannot be cancelled.
Gets or sets a value indicating the client-side event handler that is called while the user is sliding the selected region, thus changing the both SelectionStart and SelectionEnd values.
[ClientControlEvent]
[ClientPropertyName("slideRange")]
public virtual string OnClientSlideRange { get; set; }
A string specifying the name of the JavaScript function which will handle the event. The default value is empty string.
If specified, the OnClientSlideRange client-side event handler that is called while the selected region is being slided. Two parameters are passed to the handler:
- sender, the RadSlider object.
- args.
This event cannot be cancelled.
Gets or sets a value indicating the client-side event handler that is called when the user releases the selected region of RadSlider, after dragging it, thus changing both SelectionStart and SelectionEnd values.
[ClientControlEvent]
[ClientPropertyName("slideRangeEnd")]
public virtual string OnClientSlideRangeEnd { get; set; }
A string specifying the name of the JavaScript function that will handle the event. The default value is empty string.
If specified, the OnClientSlideRangeEnd client-side event handler that is called when slide has ended. Two parameters are passed to the handler:
- sender, the RadSlider object.
- args.
This event cannot be cancelled.
Gets or sets a value indicating the client-side event handler that is called just before the user starts sliding the selected region of RadSlider, thus changing both SelectionStart and SelectionEnd values.
[ClientControlEvent]
[ClientPropertyName("slideRangeStart")]
public virtual string OnClientSlideRangeStart { get; set; }
A string specifying the name of the JavaScript function which will handle the event. The default value is empty string.
If specified, the OnClientSlideRangeStart client-side event handler is called before the user starts sliding the selected region. Two parameters are passed to the handler:
- sender, the RadSlider object.
- args.
This event cannot be cancelled.
Gets or sets a value indicating the client-side event handler that is called before the sliding is started.
[ClientControlEvent]
[ClientPropertyName("slideStart")]
public virtual string OnClientSlideStart { get; set; }
A string specifying the name of the JavaScript function that will handle the event. The default value is empty string.
If specified, the OnClientSlideStart client-side event handler is called before the sliding is started. Two parameters are passed to the handler:
- sender, the RadSlider object.
- args.
This event cannot be cancelled.
[Browsable(false)]
[Obsolete("This property is now obsolete. Please use the OnClientValueChanged property instead.", false)]
public virtual string OnClientValueChange { get; set; }
Gets or sets a value indicating the client-side event handler that is called when the value of the slider has been changed.
[ClientControlEvent]
[ClientPropertyName("valueChanged")]
public virtual string OnClientValueChanged { get; set; }
A string specifying the name of the JavaScript function that will handle the event. The default value is empty string.
Two parameters are passed to the handler:
- sender, the RadSlider object.
- args.
This event cannot be cancelled.
Gets or sets a value indicating the client-side event handler that is called just before the value of the slider changes.
[ClientControlEvent]
[ClientPropertyName("valueChanging")]
public virtual string OnClientValueChanging { get; set; }
A string specifying the name of the JavaScript function that will handle the event. The default value is empty string.
Two parameters are passed to the handler:
- sender, the RadSlider object.
- args.
This event can be cancelled.
Get/Set orientation of the slider
[ClientControlProperty]
public Orientation Orientation { get; set; }
Gets the Value of the selected item in case ItemType of the RadSlider control equals SliderItemType.Item.
[Browsable(false)]
public int SelectedIndex { get; set; }
The Value of the selected item. If there are no items in the Items collection of the RadSlider control, returns empty string.
Gets a RadSliderItem object that represents the selected item in the RadSlider control in case ItemType of the control equals SliderItemType.Item.
[Browsable(false)]
public RadSliderItem SelectedItem { get; }
A RadSliderItem object that represents the selected item. If there are no items in the Items collection of the RadSlider control, returns null.
Gets a collection of RadSliderItem objects that represent the items in the RadSlider control that are currently selected in case ItemType of the control equals SliderItemType.Item.
[Browsable(false)]
public RadSliderItemCollection SelectedItems { get; }
A RadSliderItemCollection containing the selected items.
Get/Set the position value of the slider, from where the selection region will begin
public decimal SelectedRegionStartValue { get; set; }
Gets the Value of the selected item in case ItemType of the RadSlider control equals SliderItemType.Item.
[Browsable(false)]
public string SelectedValue { get; set; }
The Value of the selected item. If there are no items in the Items collection of the RadSlider control, returns empty string.
Get/Set the SelectionEnd of the slider
public decimal SelectionEnd { get; set; }
Get/Set the SelectionStart of the slider
public decimal SelectionStart { get; set; }
Show/Hide the decrease handle
[ClientControlProperty]
public bool ShowDecreaseHandle { get; set; }
Show/Hide the drag handle
[ClientControlProperty]
public bool ShowDragHandle { get; set; }
Show/Hide the increase handle
[ClientControlProperty]
public bool ShowIncreaseHandle { get; set; }
Get/Set the step with which the slider value will change
public decimal SmallChange { get; set; }
protected override bool SupportsRenderingMode { get; }
Overrides:
protected override HtmlTextWriterTag TagKey { get; }
Overrides:
Get/Set the InteractionMode of the slider thumbs
[ClientControlProperty]
public SliderThumbsInteractionMode ThumbsInteractionMode { get; set; }
Enable/Disable whether the mouse wheel should be handled
[ClientControlProperty]
public bool TrackMouseWheel { get; set; }
Get/Set the TrackPosition of the slider track
[ClientControlProperty]
public SliderTrackPosition TrackPosition { get; set; }
Methods
Adds HTML attributes and styles that need to be rendered to the specified HtmlTextWriterTag. This method is used primarily by control developers.
protected override void AddAttributesToRender(HtmlTextWriter writer)
A HtmlTextWriter that represents the output stream to render HTML content on the client.
Overrides:
Binds the Slider control to a IEnumerable data source
public void BindToEnumerableData(IEnumerable dataSource)
IEnumerable data source
Code moved into this method from OnPreRender to make sure it executed when the framework skips OnPreRender() for some reason
protected override void ControlPreRender()
Overrides:
protected override ControlItemCollection CreateChildItemCollection()
Overrides:
protected override void DescribeComponent(IScriptDescriptor descriptor)
Overrides:
Loads the client state data
protected override void LoadClientState(Dictionary<string, object> clientState)
Overrides:
Executed when post data is loaded from the request
protected override bool LoadPostData(string postDataKey, NameValueCollection postCollection)
Overrides:
Raises the ItemDataBound event. This event is raised per item for a Data-Bound RadSlider.
protected virtual void OnItemDataBound(RadSliderItemEventArgs e)
Event arguments instance containing a reference to the currently bound item
Gets or sets a value indicating the server-side event handler that is called when the value of the slider has been changed.
protected virtual void OnValueChanged(EventArgs e)
If specified, the OnValueChanged event handler that is called when the value of the slider has been changed. Two parameters are passed to the handler:
- sender, the RadSlider object.
- args.
This event cannot be cancelled.
protected override void PerformDataBinding(IEnumerable data)
Overrides:
protected override void RaiseItemDataBound(ControlItem item)
Overrides:
Executed when post data changes should invoke a changed event
protected override void RaisePostDataChangedEvent()
Overrides:
protected override void RenderContents(HtmlTextWriter writer)
Overrides:
protected void RenderDragHandle(bool isEndDragHandle, HtmlTextWriter writer)
protected void RenderIncreaseDecreaseHandle(bool decrease, HtmlTextWriter writer)
Events
public event EventHandler ValueChanged