1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Adding 'tags' to Event display in admin module

Adding 'tags' to Event display in admin module

2 posts, 0 answered
  1. michael
    michael avatar
    20 posts
    Registered:
    09 Jan 2009
    11 Mar 2009
    Link to this post
    In the events modules, you can get a list of events and their status (and also edit and delete them).  This screen's template is provided by Sitefinity\admin\ControlTemplates\Events\ControlPanelList.ascx.

    What I would like to do is add another column that will give the tags that are associated with a given event.  I can add code that will add the column heading, but as the binding of the rows is hidden away I'm having trouble figuring out how to display the tags for each event.

    Can someone lift the veil and help me see how to display the tags?  I expect that I put in some control with a magic id of 'allTags' or 'eventTags'.
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    12 Mar 2009
    Link to this post
    Hi michael,

    There is a way to show the tags.

    Here are the steps:

    1. Create a class in App_Code directory that will list your tags.

    public class MyTags 
        public static string ReturnTags(IContent content) 
        { 
            ContentManager manager = new ContentManager(content.ProviderName); 
            IList tags = manager.GetTags(content.ID); 
            StringBuilder sb = new StringBuilder(); 
            foreach (ITag tag in tags) 
            { 
                sb.Append(tag.TagName); 
                sb.Append(", "); 
            } 
            if(sb.Length > 0) 
                sb.Remove(sb.Length - 1, 1); 
            return sb.ToString(); 
        } 


    2. Add the code snippet to your template

    <asp:TemplateField HeaderText="Tags"
            <ItemTemplate> 
    <%# MyTags.ReturnTags((Telerik.Cms.Engine.IContent)Container.DataItem)%> 
            </ItemTemplate> 
    </asp:TemplateField>         

    Then you will see you tagged items in the grid.

    All the best,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
2 posts, 0 answered