adding tags clientside

2 posts, 0 answers
  1. d
    d avatar
    2 posts
    Member since:
    Mar 2011

    Posted 05 Mar 2011 Link to this post

    Is there anything in the clientside api for adding and removing items?
  2. Pero
    Pero avatar
    1156 posts

    Posted 09 Mar 2011 Link to this post


    This functionality is not supported by the TagCloud control, but it can be easily achieved with a bit of JavaScript code. For your convenience I have created a sample project that shows how this can be done:

    Copy Code
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
    <head runat="server">
        <script type="text/javascript">
            function AddItem()
                var tagCloud = $find("TagCloud1");
                var liElement = document.createElement("li");
                liElement.innerHTML = "<a href='' ref='tag' title='Telerik'>Telerik</a>";
                Sys.UI.DomElement.addCssClass(liElement, "rtcTagItem");
                var tagCloudItem = $create(Telerik.Web.UI.RadTagCloudItem, { navigateUrl: "" }, null, null, liElement);
                Array.add(tagCloud.get_items(), tagCloudItem);
        <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
            <asp:Label ID="Label1" runat="server"></asp:Label>
            <input type="button" onclick="AddItem();" value="Add Item" />
        <telerik:RadTagCloud ID="TagCloud1" runat="server" Width="400px">
                <telerik:RadTagCloudItem Text="ASP.NET" Weight="12" />
                <telerik:RadTagCloudItem Text="AJAX" Weight="134" />
                <telerik:RadTagCloudItem Text="VB" Weight="56" />
                <telerik:RadTagCloudItem Text="C#" Weight="38" />
                <telerik:RadTagCloudItem Text="Web" Weight="73" />

    All the best,
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Back to Top