RadRating
RadRating class
Definition
Namespace:Telerik.Web.UI
Assembly:Telerik.Web.UI.dll
Syntax:
[EmbeddedSkin("Rating")]
[EmbeddedSkin("Rating", "Default")]
[RequiredCss("Telerik.Web.UI.Skins.Common.fonticons.css", RenderMode.Lightweight, typeof(RadRating))]
[ValidationProperty("Value")]
[ClientScriptResource("Telerik.Web.UI.RadRating", "Telerik.Web.UI.Rating.RadRating.js")]
[TelerikToolboxCategory("Miscellaneous")]
[ToolboxBitmap(typeof(RadRating), "Toolbox.Icons.Rating.png")]
[RequiredScript(typeof(jQueryPlugins))]
public class RadRating : RadDataBoundControl, IComponent, IDisposable, IParserAccessor, IUrlResolutionService, IDataBindingsAccessor, IControlBuilderAccessor, IControlDesignerAccessor, IExpressionsAccessor, IAttributeAccessor, IScriptControl, IControlResolver, IPostBackDataHandler, ISkinnableControl, IControl, IFeatureGroup, IPostBackEventHandler
Inheritance: objectControlWebControlBaseDataBoundControlDataBoundControlRadDataBoundControlRadRating...
Implements:
Inherited Members
Constructors
public RadRating()
Properties
Gets/Sets a value indicating whether the DataBound items should be appended to the Rating Items collection, or the collection should be cleared before creating the DataBound items.
public bool AppendDataBoundItems { get; set; }
Get/Set a value indicating whether the RadRating control will initiate a postback after its value changes.
[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 RadRating 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.
Get/Set a value indicating whether the RadRating control will display a browser toolip for its values.
[ClientControlProperty]
public bool EnableToolTips { get; set; }
Get/Set the direction of the RadRating control, that is, the position of the item (star) with value 1.
[ClientControlProperty]
public bool IsDirectionReversed { get; set; }
Gets the object through which the user should provide the binding information about the rating items.
[PersistenceMode(PersistenceMode.InnerProperty)]
public RatingItemBinding ItemBinding { get; }
Get/Set the number of items in the RadRating control - e.g. the number of stars that the control will have.
[ClientControlProperty]
[ClientPropertyName("_itemCount")]
public int ItemCount { get; set; }
Get/Set the height of each item in the RadRating control.
[ClientControlProperty]
[ClientPropertyName("_itemHeight")]
public Unit ItemHeight { get; set; }
Default: Unit.Empty
Gets a RadRatingItemCollection object that contains the items of the current RadRating control.
[PersistenceMode(PersistenceMode.InnerProperty)]
public RadRatingItemCollection Items { get; }
A RadRatingItemCollection that contains the items of the current RadRating control. By default the collection is empty (RadRating creates its items, based on the value of its ItemCount property).
Use the Items property to access the child items of RadRating. You can add, remove or modify items from the Items collection.
Get/Set the width of each item in the RadRating control.
[ClientControlProperty]
[ClientPropertyName("_itemWidth")]
public Unit ItemWidth { get; set; }
Default: Unit.Empty
Gets or sets a value indicating the client-side event handler that is called when the RadRating control is initialized.
[ClientControlEvent]
[ClientPropertyName("load")]
public string OnClientLoad { get; set; }
A string specifying the name of the JavaScript function that will handle the event. The default value is an empty string.
Two parameters are passed to the handler:
- sender, the RadRating object that raised the event.
- args.
This event cannot be cancelled.
Gets or sets a value indicating the client-side event handler that is called when the user clicks an item (star) of the RadRating control.
[ClientControlEvent]
[ClientPropertyName("rated")]
public string OnClientRated { get; set; }
A string specifying the name of the JavaScript function that will handle the event. The default value is an empty string.
Two parameters are passed to the handler:
- sender, the RadRating object that raised the event.
- args.
This event cannot be cancelled.
Gets or sets a value indicating the client-side event handler that is called when the user clicks an item (star) of the RadRating control, but before the new value is set.
[ClientControlEvent]
[ClientPropertyName("rating")]
public string OnClientRating { get; set; }
A string specifying the name of the JavaScript function that will handle the event. The default value is an empty string.
Two parameters are passed to the handler:
- sender, the RadRating object that raised the event.
- args.
This event can be cancelled.
Get/Set the orientation of the RadRating control.
[ClientControlProperty]
public Orientation Orientation { get; set; }
Get/Set the rating precision for the RadRating control - the precision with which the user can rate.
[ClientControlProperty]
public RatingPrecision Precision { get; set; }
Get/Set a value indicating whether the RadRating control is in read-only mode.
[ClientControlProperty]
[ClientPropertyName("readOnly")]
public bool ReadOnly { get; set; }
Gets a RadRatingItem object that represents the selected item in the RadRating control in case Items collection of the control is not empty.
[Browsable(false)]
public RadRatingItem SelectedItem { get; }
A RadRatingItem object that represents the selected item. If there are no items in the Items collection of the RadRating control, returns null.
Gets a RadRatingItemCollection object that contains the selected items in the RadRating control. The collection is empty in case there are no items in the Items collection of the control.
[Browsable(false)]
public RadRatingItemCollection SelectedItems { get; }
A RadRatingItemCollection containing the selected items.
Get/Set the selection mode for the RadRating control - when the user rates, either mark a single item (star) as selected or all items(stars) from the first to the selected one.
[ClientControlProperty]
public RatingSelectionMode SelectionMode { get; set; }
protected override HtmlTextWriterTag TagKey { get; }
Overrides:
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 Rating 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 void DescribeClientEvents(IScriptDescriptor descriptor)
Overrides:
protected override void DescribeClientProperties(IScriptDescriptor descriptor)
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:
Executed right after the item is created and inserted in the Rating Items collection.
Executed right after the item is data-bound to the data source.
Gets or sets a value indicating the server-side event handler that is called when the current rating of the RadRating control changes.
protected virtual void OnRate(EventArgs e)
Two parameters are passed to the handler:
- sender, the RadRating object that raised the event.
- args.
protected override void PerformDataBinding(IEnumerable data)
Overrides:
protected void PrepareForDataBinding()
Executed when post data changes should invoke a changed event
protected override void RaisePostDataChangedEvent()
Overrides:
protected override void RenderContents(HtmlTextWriter writer)
Overrides:
protected override void TrackViewState()
Overrides:
Events
Adds or removes an event handler method from the ItemDataBound event. Fired after a rating item is created and inserted in the Rating Items collection.
public virtual event EventHandler<RatingEventArgs> ItemCreated
Adds or removes an event handler method from the ItemDataBound event. Fired after a rating item (star) is data bound.
public virtual event EventHandler<RatingEventArgs> ItemDataBound
Adds or removes an event handler method from the Rate event. Fired after a rating item (star) is clicked.
public virtual event EventHandler Rate