RadTagCloud
Telerik RadTagCloud is a UI component for ASP.NET AJAX applications, which displays a panel (cloud) of commonly used or related keywords.
Definition
Namespace:Telerik.Web.UI
Assembly:Telerik.Web.UI.dll
Syntax:
[RequiredScript(typeof(jQueryPlugins))]
[ClientScriptResource("Telerik.Web.UI.RadTagCloud", "Telerik.Web.UI.TagCloud.RadTagCloud.js")]
[TelerikToolboxCategory("Miscellaneous")]
[ToolboxBitmap(typeof(RadTagCloud), "Toolbox.Icons.TagCloud.png")]
[EmbeddedSkin("TagCloud")]
[EmbeddedSkin("TagCloud", "Default")]
public class RadTagCloud : RadDataBoundControl, IComponent, IDisposable, IParserAccessor, IUrlResolutionService, IDataBindingsAccessor, IControlBuilderAccessor, IControlDesignerAccessor, IExpressionsAccessor, IAttributeAccessor, IScriptControl, IControlResolver, IPostBackDataHandler, ISkinnableControl, IControl, IFeatureGroup, IPostBackEventHandler, INamingContainer
Inheritance: objectControlWebControlBaseDataBoundControlDataBoundControlRadDataBoundControlRadTagCloud...
Implements:
Inherited Members
Constructors
public RadTagCloud()
Properties
Specifies whether the TagCloud items created on the client-side should be cleared before data binding.
[ClientControlProperty]
public bool AppendClientDataBoundItems { get; set; }
Gets or sets a bool value that indicates whether tagCloud items are cleared before data binding.
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.
public virtual bool AutoPostBack { get; set; }
The default value is false.
Setting this property to true will make Telerik RadTagCloud postback to the server on item click.
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 field of the data source that provides the URL (NavigateUrl) content of the TagCloud items.
public string DataNavigateUrlField { get; set; }
Gets or sets the formatting string used to control how data bound to the NavigateUrl property of the TagCloud item is displayed.
public string DataNavigateUrlFormatString { get; set; }
Gets or sets the field of the data source that provides the text content of the TagCloud items.
public string DataTextField { get; set; }
Gets or sets the formatting string used to control how data bound to the Text property of the TagCloud item is displayed.
public string DataTextFormatString { get; set; }
Gets or sets the field of the data source that provides the ToolTip content of the TagCloud items.
public string DataToolTipField { get; set; }
Gets or sets the formatting string used to control how data bound to the ToolTip property of the TagCloud item is displayed.
public string DataToolTipFormatString { get; set; }
Gets or sets the field of the data source that provides the value content of the TagCloud items.
public string DataValueField { get; set; }
Gets or sets the field of the data source that provides the weight of the TagCloud items.
public string DataWeightField { get; set; }
Gets or sets a value indicating how the font-size will be distributed among the different words. There is Linear and Logarithmic Distribution. (Use Telerik.Web.UI.TagCloudDistribution.Linear or Telerik.Web.UI.TagCloudDistribution.Logarithmic)
[ClientControlProperty]
public TagCloudDistribution Distribution { get; set; }
Gets the collection of all TagCloud items currently present in the TagCloud.
[PersistenceMode(PersistenceMode.InnerProperty)]
[Browsable(false)]
public RadTagCloudItemCollection Items { get; }
Gets or sets the fore color to the most important (frequent) item.
public Color MaxColor { get; set; }
Gets or sets the font-size to the most important (frequent) item.
[ClientControlProperty]
public Unit MaxFontSize { get; set; }
Gets or sets the number of visible items in the cloud.
[ClientControlProperty]
public int MaxNumberOfItems { get; set; }
The default value is 0, which means the items will not be filtered.
Gets or sets the fore color to the least important (frequent) item.
public Color MinColor { get; set; }
Gets or sets the font-size to the least important (frequent) item.
[ClientControlProperty]
public Unit MinFontSize { get; set; }
Gets or sets the minimal weight a TagCloud item could have. If the weight of the item is less than this value, the keyword will not appear in the cloud.
[ClientControlProperty]
public double MinimalWeightAllowed { get; set; }
The default value is 0.0, which means the items will not be filtered.
Gets or sets the name of the JavaScript function that will be called when the Rotator is databound on the client-side.
[ClientControlEvent]
[ClientPropertyName("dataBound")]
public string OnClientDataBound { get; set; }
The name of the javascript function called after an item is clicked.
[ClientControlEvent]
[ClientPropertyName("itemClicked")]
public string OnClientItemClicked { get; set; }
The name of the javascript function called when an item is clicked.
[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.
[ClientControlEvent]
[ClientPropertyName("itemDataBound")]
public string OnClientItemDataBound { get; set; }
Gets or sets a value indicating the client-side event handler that is called when the RadTagCloud items were just populated from web service.
[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 RadTagCloud when loading has failed.
[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 RadTagCloud items are about to be populated from web service. The event is cancellable
[Bindable(false)]
[ClientControlEvent]
[ClientPropertyName("itemsRequesting")]
public string OnClientItemsRequesting { get; set; }
The name of the javascript function when the control loads.
[ClientControlEvent]
[ClientPropertyName("load")]
public string OnClientLoad { get; set; }
The URL to post to when an item is clicked.
[Themeable(false)]
public string PostBackUrl { get; set; }
Gets or sets the punctuation characters that will not be included in the TagCloud, when generated from text source.
When none are specified, the Char.IsPunctuation(Char c) method is used to check whether a character is punctuation mark.
The property should be used in conjuction with the following properties: Text.
public string PunctuationCharacters { get; set; }
Gets or sets the punctuation characters that will be considered valid (i.e. they should be considered as a character of the word), if they appear between alphanumeric characters. For example the following words are valid, although they have punctuation characters: ASP.NET, web-site, telerik.com, web.config
public string PunctuationCharactersValid { get; set; }
Gets or sets a bool value indicating whether the item weight will be rendered. It is rendered right next to the item's text.
[ClientControlProperty]
public bool RenderItemWeight { get; set; }
Gets or sets a value indicating how the TagCloud items will be sorted. Possible values are alphabetic and weighted sorting in ascending/descending order.
[ClientControlProperty]
public TagCloudSorting Sorting { get; set; }
protected override bool SupportsRenderingMode { get; }
Overrides:
protected override HtmlTextWriterTag TagKey { get; }
Overrides:
Must be used with MaxNumberOfItems property.
Gets or sets a bool value indicating whether the [MaxNumberOfItems] visible items will be the ones with the biggest weight,
or the ones that occur first in the DataSource. The default value is false.
public bool TakeTopWeightedItems { get; set; }
Gets or sets the target window or frame to display the new content when the TagCloud item is clicked.
[TypeConverter(typeof(TargetConverter))]
[ClientControlProperty]
[ClientPropertyName("target")]
public string Target { get; set; }
Gets or sets text from which a weighted cloud will be generated. Most frequent words are more important.
public string Text { get; set; }
Gets or sets the text (.TXT) file from which text will be retrieved to generate tags.
public string TextFile { get; set; }
Gets or sets the URL from which text will be retrieved to generate tags.
public string TextUrl { get; set; }
Gets the settings for the web service used to populate items
[PersistenceMode(PersistenceMode.InnerProperty)]
public WebServiceSettings WebServiceSettings { get; }
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 TagCloudDataItem[] WebServiceMethodName(int itemIndex, int itemCount) { List<TagCloudDataItem> result = new List<TagCloudDataItem>(); TagCloudDataItem item; for (int i = 0; i < itemCount; i++) { item = new RadTagCloudItemData(); item.accessKey = ""; item.navigateUrl = ""; item.tabIndex = ""; item.text = ""; item.toolTip = ""; item.value = ""; item.weight = 0; result.Add(item); } return result.ToArray(); } }
Gets or sets the array of words that will be excluded from the TagCloud, when the cloud is generated from a text source.
[TypeConverter(typeof(ListConverter))]
public string[] WordsToExclude { get; set; }
Methods
protected override void AddAttributesToRender(HtmlTextWriter writer)
Overrides:
Binds the TagCloud to an IEnumerable data source.
public void BindToEnumerableData(IEnumerable dataSource)
The data source to bind to.
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 DescribeComponent(IScriptDescriptor descriptor)
Overrides:
protected virtual RadTagCloudItem FindItemByHierarchicalIndex(string hierarchicalIndex)
Populates the Items collection of the current TagCloud, from a provided text. Every word is weighted based on its occurence in the text.
public void GenerateTagsFromText(string text)
The text from which a weighted cloud will be generated.
Loads the client state data
protected override void LoadClientState(Dictionary<string, object> clientState)
Overrides:
Executed when a TagCloud item is clicked.
Executed right after the item is databound to the data source.
protected override void PerformDataBinding(IEnumerable data)
Overrides:
protected void PrepareForDataBinding()
protected void RaiseTagCloudItemEvent(RadTagCloudItem item, object eventKey)
Reads an HTML document from the provided URL and returns the text as a string. If the URL does not exist, or the HTML document is not valid, a string.Empty is returned.
protected override void RenderContents(HtmlTextWriter writer)
Overrides:
protected override void TrackViewState()
Overrides:
Events
Adds or removes an event handler method from the ItemClick event. The event is fired after RadTagCloudItem is clicked.
public event RadTagCloudEventHandler ItemClick
Adds or removes an event handler method from the ItemDataBound event. The event is fried right after RadTagCloudItem is databound.
public event RadTagCloudEventHandler ItemDataBound