More in this section

Forums / Developing with Sitefinity / Event item view

Event item view

5 posts, 0 answered
  1. Devin
    Devin avatar
    149 posts
    Registered:
    09 Jun 2009
    28 Oct 2009
    Link to this post
    Hi I'm customizing ContentViewItemView.ascx to display events like this:

    * Title
    * Date
    * City
    * Content
    * More link

    I want the Title and More link to both link to the same place.  Here's my code from the Repeater ItemTemplate:
                <div class="sf_eventTitle"
                    <asp:HyperLink ID="fullContent1" runat="server"
                        <asp:Literal ID="Title" runat="server"/> 
                    </asp:HyperLink> 
                </div> 
                <class="sf_eventPriod"
                    <%-- <telerik:DateTimeLiteral runat="server" ID="Publication_Date" DateFormatString="D"></telerik:DateTimeLiteral> --%> 
                    <telerik:DateTimeLiteral runat="server" ID="Event_Start" DateFormatString="D"></telerik:DateTimeLiteral> 
                </p> 
                <class="sf_contentCity"
                    <asp:Literal ID="City" runat="server" /> 
                </p> 
                <asp:Panel id="pnlPostContent" runat="server" CssClass="sf_eventContent"
                    <asp:Literal ID="content" runat="server" /><br /> 
                    <href='#'>More</a> 
                </asp:Panel> 
     

    Can I do this by adding a call to DataBinder.Eval in the more link?  Something like this:

    <href='<%# DataBinder.Eval(Container.DataItem, "contentLink") %>'>More</a> 

    Or maybe calling a method of some kind?  I guess I'm trying to figure out how fullContent1 gets it's NavigateUrl property...  I hope this makes sense and I'm not blabbering on too much.

    Thanks in advance!
    Devin
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    28 Oct 2009
    Link to this post
    Hello Devin,

    Please use ListPageMaster.ascx template instead of ContentViewItemView.ascx. ListPageMaster has a "more information" url which by design points to the same destination as when you click on the Event item title.

    Let us know how it goes.

    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.
  3. Devin
    Devin avatar
    149 posts
    Registered:
    09 Jun 2009
    28 Oct 2009
    Link to this post
    That did it!  Thanks Ivan, you're the best!
  4. Devin
    Devin avatar
    149 posts
    Registered:
    09 Jun 2009
    16 Jun 2010
    Link to this post
    Hi is there a way to customize ListPageMaster.ascx so that I can add a third link in the News view?  For example, a thumbnail that links to the detail page?

    Thanks!
    Devin
  5. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    16 Jun 2010
    Link to this post
    Hello Devin,

    You can surround the thumbnail image with a hyperlink and add this code to the control template:
    <script type="text/C#" runat="server">
        protected void Page_Load()
        {
            repeater.ItemDataBound += new RepeaterItemEventHandler(repeater_ItemDataBound);
        }
     
        void repeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                HyperLink fullContent1 = (HyperLink)e.Item.FindControl("fullContent1");
                HyperLink thumbnailLink = (HyperLink)e.Item.FindControl("ThumbnalLink");
                thumbnailLink.NavigateUrl = fullContent1.NavigateUrl;
            }
        }
    </script>

    <asp:PlaceHolder ID="ThumbnailHolder" runat="server">
        <p class="sf_newsThumbnail"><asp:HyperLink ID="ThumbnalLink" runat="server"></asp:HyperLink><asp:Image ID="Thumbnail" runat="server" /></asp:HyperLink></p>
    </asp:PlaceHolder>

    Kind regards,
    Radoslav Georgiev
    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.
Register for webinar
5 posts, 0 answered