Try Now
More in this section

Forums / Developing with Sitefinity / Attach URL to tag

Attach URL to tag

2 posts, 0 answered
  1. Brett
    Brett avatar
    36 posts
    23 Jul 2010
    15 Sep 2010
    Link to this post
    I would like to be able to attach a URL to each tag in the tag cloud to a different URL within the site for each tag so that when I insert a tag list into my page, I would have the normal list with the number of times the tag was used in parenthesis, but to link to a specifed page in the site if the tag is clicked.

    Any and all help is appreciated.
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    19 Oct 2016
    15 Sep 2010
    Link to this post
    Hello Brett,

    You have to create a custom class that inherits from Telerik.Cms.Engine.WebControls.Tags.TagsList. Override InitializeControls and subscribe for ItemDataBound event of TagsRepeaterCloud

    TagsRepeaterCloud.ItemDataBound += this.TagsRepeaterCloud_ItemDataBound;

    Inside the event you can access the hyperlink that is displayed by the control and set its NavigateUrl.

    private void TagsRepeaterCloud_ItemDataBound(object sender, RepeaterItemEventArgs e)
              if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
                  ITag tag = (ITag)e.Item.DataItem;
                  HyperLink tagLink = (HyperLink)e.Item.FindControl("tagLink")
                  // set tagLink NavigateUrl

    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered