More in this section

Forums / Developing with Sitefinity / Adding thumbnail to Events module

Adding thumbnail to Events module

2 posts, 1 answered
  1. GV
    GV avatar
    33 posts
    Registered:
    11 Sep 2009
    07 Dec 2009
    Link to this post
    Good evening Sitefinity team.

    I'm using Sitefinity 3.6. I have a requirement where I need to show thumbnail if present against an event (Almost same as in News module).
    I'm not sure whether it can be done through meta fields.

    Please suggest me the way to do this.

    Thanks & regards
    Krishna
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    07 Dec 2009
    Link to this post
    Hi Gopal Vemulapalli,

    It is possible. You need to create a new metakey for thumbnails - the same as we have for news. You have to map EventsItemEdit and EventsItemNew templates and add ButtonSelector control inside ContentMetafields control.

    <li class="selector">
                      <asp:Label ID="Label11" AssociatedControlID="Meta2" runat="server"><asp:Literal ID="Literal25" runat="server" Text="<%$Resources:Thumbnail %>"></asp:Literal> <em id="Em3" runat="server"></em></asp:Label>
                      <asp:TextBox ID="Meta2" Text="" runat="server" MaxLength="250"></asp:TextBox>
                      <sfLib:ButtonSelector WindowNavigateUrl="~/Sitefinity/Admin/ControlTemplates/Pages/Dialogs/PagesSelector.ascx" ItemTemplatePath="~/Sitefinity/Admin/ControlTemplates/News/Dialogs/ButtonSelector.ascx" AssociatedControls="Meta2" runat="server" cssclass="pickerWrapper" ButtonText="<%$Resources:Select%>" />
                      <p class="example">
                          <asp:Literal ID="Literal26" runat="server" Text="Meta2Note"></asp:Literal>
                      </p>
                  </li>

    Since the returned value from the selector is dynamic, you have to create custom control that inherits from EventsView. In your custom control you have to override SetItemMetaData method, then access the metakey and resolve the url.

    sample code:

    public class CustomEventsView : EventsView
    {
        public CustomEventsView()
        {
     
        }
     
        public override string ItemListTemplatePath
        {
            get
            {
                return "~/Sitefinity/Admin/ControlTemplates/Events/Design/ListPageMaster.ascx";
            }
     
        }
     
        public override string SingleItemTemplatePath
        {
            get
            {
                return "~/Sitefinity/Admin/ControlTemplates/Events/Design/ListPageDetail.ascx";
            }
             
        }
     
        protected override void SetItemMetadata(Control itemContainer, Telerik.Cms.Engine.IContent contentItem)
        {
            base.SetItemMetadata(itemContainer, contentItem);
     
            // here resolve the metadata text
        }
    }

    Useful link : Resolving dynamic links

    All the best,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Answered
2 posts, 1 answered