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

Forums / Developing with Sitefinity / BlogArchive control with blog titles instead

BlogArchive control with blog titles instead

3 posts, 0 answered
  1. Ege AKPINAR
    Ege AKPINAR avatar
    6 posts
    Registered:
    01 Dec 2009
    22 May 2010
    Link to this post
    Hello,

    I want to list blog post titles as a navigatable tree (similar to BlogArchive control where posts are grouped by months. I want them to be listed by their titles instead)

    Is there an easy way to do this? I noticed CustomDataSource property in BlogArchive control's settings and thought that might be of use.

    Thanks in advance,
    Ege
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    24 May 2010
    Link to this post
    Hi Ege AKPINAR,

    You need to create a custom control to achieve your goal.

    You need to build a custom RadTreeView control where the parent is a given blog and the posts are child nodes. You should set NavigateUrl property of each node to the page where your post resides.

    Below is a sample code that you could use

    protected void Page_Load(object sender, EventArgs e)
      {
     
     
          var manager = new BlogManager("Blogs");
          RadTreeView1.DataSource = manager.GetBlogs();
          RadTreeView1.NodeDataBound += new Telerik.Web.UI.RadTreeViewEventHandler(RadTreeView1_NodeDataBound);
          RadTreeView1.DataBind();
           
      }
     
      void RadTreeView1_NodeDataBound(object sender, Telerik.Web.UI.RadTreeNodeEventArgs e)
      {
     
         var mgr = new ContentManager("Blogs");
         IBlog blog  = e.Node.DataItem as IBlog;
         e.Node.Text = blog.Name;
         e.Node.NavigateUrl = "";
         foreach (IContent cnt in mgr.GetContent())
         {
             if (cnt.ParentID == blog.ID)
             {
                 RadTreeNode node = new RadTreeNode();
                 node.Text = cnt.GetMetaData("Title").ToString();
                 node.NavigateUrl = "";s
                 e.Node.Nodes.Add(node);
             }
         }


    Kind regards,
    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.
  3. Ege AKPINAR
    Ege AKPINAR avatar
    6 posts
    Registered:
    01 Dec 2009
    28 May 2010
    Link to this post
    Worked like a charm, thanks!
Register for webinar
3 posts, 0 answered