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

Forums / Developing with Sitefinity / "Back" link in Blogs module

"Back" link in Blogs module

2 posts, 0 answered
  1. ddblee
    ddblee avatar
    20 posts
    Registered:
    24 Jul 2008
    06 Oct 2008
    Link to this post
    I have wired up a custom dropdown menu to allow users to select specific categories for display within the blog. It is working satisfactorily, but a side effect has materialized with respect to the "Back" link in the Custom Control at ~\Sitefinity\ControlTemplates\Blogs\Modes\ListPageDetail.ascx

    If a user uses the dropdown to navigate to blog.aspx?BlogCatID=[CategoryGuid], and then clicks on the Post Title of a specific blog posting, the "Back to All Posts" link is passed a value that includes this Category guid. Since We want to go back to ALL posts, we would like to override the way that

    <div class="sf_singlePost">
        <p class="sf_back">
           <asp:HyperLink ID="backToList1" Text="<%$Resources:GoBack %>" runat="server"></asp:HyperLink>
        </p>

    gets its HREF wired up. Is there an easy way to do that?

    Thanks!

  2. Pepi
    Pepi avatar
    981 posts
    Registered:
    31 Jan 2017
    10 Oct 2008
    Link to this post
    Hi ddblee,

    You should create your own control that inherits BlogPosts base class and override CreateSingleContent method. Here is a simple example:

    .cs
    using System; 
    using System.Data; 
    using System.Configuration; 
    using System.Web; 
    using System.Web.Security; 
    using System.Web.UI; 
    using System.Web.UI.HtmlControls; 
    using System.Web.UI.WebControls; 
    using System.Web.UI.WebControls.WebParts; 
    using Telerik.Blogs.WebControls; 
    using Telerik.Blogs; 
     
    namespace Telerik.Blogs.WebControls 
        public class BlogPostsUpdate : BlogPosts 
        { 
            protected override void CreateSingleContent() 
            { 
                base.CreateSingleContent(); 
     
                SingleContainer.BackLinks[0].NavigateUrl = this.ResolveUrl("~/blogs.aspx"); 
            } 
        } 

    After that you need to declare the new control in the <toolboxControls> section of the web.config to display it in the toolbox:

    <add name="BlogPostsUpdate" section="Blogs" type="Telerik.Blogs.WebControls.BlogPostsUpdate, App_Code" /> 

    Do let us know how it goes.

    Sincerely yours,
    Pepi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
2 posts, 0 answered