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

Forums / Developing with Sitefinity / Passing same info to a new page

Passing same info to a new page

10 posts, 0 answered
  1. Steven Lancaster
    Steven Lancaster avatar
    82 posts
    Registered:
    06 Nov 2009
    21 Jan 2010
    Link to this post
    I have control called ContentViewSingleItem.ascx it actually returns the ful content of 1 story see code below.

    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="ContentViewSingleItem.ascx.cs" Inherits="Sitefinity_ControlTemplates_Blogs_ContentViewSingleItem" %> 
    <%@ Register Assembly="Telerik.Cms.Engine" Namespace="Telerik.Cms.Engine.WebControls" TagPrefix="sfWeb" %> 
    <%@ Register Assembly="Telerik.Cms.Web.UI" Namespace="Telerik.Web.UI.SpamProtection" TagPrefix="sfWeb" %> 
    <%@ Register Assembly="Telerik.Cms.Web.UI" Namespace="Telerik.Cms.Web.UI" TagPrefix="sfWeb" %> 
    <%@ Register Assembly="Telerik.Blogs" Namespace="Telerik.Blogs.WebControls" TagPrefix="sfWeb" %> 
    <%@ Register TagPrefix="sf" Assembly="Telerik.Cms.Engine" Namespace="Telerik.Cms.Engine.WebControls" %> 
    <%@ Register TagPrefix="TN" TagName="ucPostAnonomously" Src="~/Sitefinity/ControlTemplates/Blogs/ucPostAnonomously.ascx" %> 
    <%@ Register TagPrefix="TN" TagName="ucSendFriend" Src="~/Sitefinity/ControlTemplates/Blogs/ucSendFriend.ascx" %> 
     
    <telerik:CssFileLink ID="CssFileLink1" EmbeddedFileName="Telerik.Blogs.Resources.ControlTemplates.Frontend.blogsCommonLayout.css" FileName="" Media="screen" runat="server" /> 
    <telerik:JsFileLink id="jsLink" runat="server" ScriptType="jQuery" />   
     
    <asp:PlaceHolder ID="trackbackScript" runat="server">  
     
    </asp:PlaceHolder> 
     
    <div class="sf_singlePost">  
    <asp:Label ID="AuthorPhoto" runat="server" Visible="false"></asp:Label> 
        <asp:Label ID="AuthorName" runat="server" Visible="false"></asp:Label> 
        <asp:Label ID="AuthorBioURL" runat="server" Visible="false"></asp:Label> 
          
        <%--<class="sf_back">  
           <asp:HyperLink ID="backToList1" Text="<%$Resources:GoBack %>" runat="server"></asp:HyperLink>   
        </p>--%> 
     
       <h1 class="sf_postTitle">  
            <asp:Literal ID="Title" runat="server"></asp:Literal> 
        </h1> 
          
         <!-- post author :begin--> 
        <div class="post-author">  
            <span class="a-img-bg"><sfWeb:SitefinityImage  ID="sfReporterPhoto" runat="server" Width="176px" Height="199px"  /></span><span class="a-name"><asp:Literal ID="lAuthorName" runat="server"></asp:Literal></span>  
            <class="a-desc"><asp:Literal ID="ReporterCaption" runat="server"></asp:Literal></p>  
            <asp:HyperLink ID="hpAuthorBioURL" runat="server" ></asp:HyperLink> 
         </div> 
        <!-- post author :end--> 
          
       <class="sf_postAuthor">  
            <%--<asp:Literal ID="Literal3" runat="server" Text="<%$Resources:Author %>"></asp:Literal> 
            <asp:HyperLink ID="postedBy" runat="server">  
                <asp:Literal ID="Author" runat="server"></asp:Literal> 
            </asp:HyperLink>--%> 
            Written By: <asp:Literal ID="lAuthorName2" runat="server"></asp:Literal> 
        </p> 
       <class="sf_postAuthor">  
                &nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
                <asp:Literal ID="ReporterCaption2" runat="server"></asp:Literal> 
        </p> 
        <class="sf_postDate">  
            <telerik:DateTimeLiteral runat="server" ID="Publication_Date" DateFormatString="D"></telerik:DateTimeLiteral> 
        </p> 
        <asp:Panel ID="pnlContent" runat="server" CssClass="sf_postContent">  
            <asp:Literal ID="content" runat="server"></asp:Literal> 
        </asp:Panel> 
         <%--<class="sf_postCategory">  
            <asp:Literal ID="CategoryLiteral" runat="server" Text="<%$Resources:Category %>" /><asp:HyperLink ID="Category" runat="server" /> 
         </p>--%> 
         <class="sf_postTags">  
              
            <asp:Repeater ID="Tags" runat="server">  
                <HeaderTemplate> 
                    <asp:Literal ID="TagsLiteral" runat="server" Text="<%$Resources:Tags %>" /> 
                </HeaderTemplate> 
                <ItemTemplate> 
                    <asp:HyperLink ID="tagLink" runat="server" /> 
                </ItemTemplate> 
            </asp:Repeater> 
        </p> 
          
        <asp:Repeater ID="Bookmarks" runat="server">  
            <HeaderTemplate><ul class="sf_socialBookmarks"></HeaderTemplate> 
            <ItemTemplate> 
                <li> 
                    <asp:HyperLink ID="BookmarkLink" runat="server">  
                        <asp:Image ID="BookmarkImage" runat="server" /> 
                    </asp:HyperLink> 
                </li> 
            </ItemTemplate>    
            <FooterTemplate></ul></FooterTemplate> 
        </asp:Repeater>    
          
    </div> 
     
     
    <div class="">  
        <sfWeb:BlogCommentsList ID="commentsList" runat="server" CssClass="sf_commentsList" ValidationGroup="commentInfo">  
                  <LayoutTemplate> 
            <asp:Repeater ID="commentsRepeater" runat="Server" > 
              
        <HeaderTemplate> 
            <asp:PlaceHolder runat="server" ID="headerHolder" Visible="true">  
                <h2 class="sf_comments" style="padding-left:15px;">  
                    <asp:Literal ID="Literal1" runat="server" Text="<%$Resources:Comments %>" /> 
                    (<asp:Literal ID="commentsCount" runat="server"></asp:Literal>)  
                </h2>   
            </asp:PlaceHolder>        
            <div class="sf_dbComment">  
            <ul class="sf_commentListing">  
        </HeaderTemplate> 
        <ItemTemplate>   
            <!-- comment goes here --> 
            <sfWeb:CommentItem Id="anonCommentContainer" runat="server" CssClass="sf_anonymousComment" >   
              
             <Template> 
                  
                    <div class="sfComment1Top"></div> 
                    <div class="sfComment1Body">  
                        <asp:Label ID="text" runat="server"></asp:Label> 
                    </div> 
                    <div class="sfComment1Bot"></div>             
                 
                   <class="sf_commentAuthor" style="padding-left:20px;">  
                        <strong style="color:#d81b1a">  
                            <asp:HyperLink ID="webSiteLink" runat="server" Visible="false" rel="nofollow"></asp:HyperLink> 
                            <asp:Literal runat="Server" ID="authorName"  Visible="false"></asp:Literal>   
                        </strong> 
                        <%--<abbr class="date" id="commentDate" runat="server" > </abbr>--%> 
                        <telerik:DateTimeLiteral ID="commentDateLiteral" runat="server" DateFormatString="f" /> 
                    </p> 
                  
            </Template> 
             
            </sfWeb:CommentItem> 
             
            <sfWeb:CommentItem Id="authorCommentContainer" runat="server"  CssClass="">   
             <Template> 
                <div class="sfComment2Top"></div> 
                <div class="sfComment2Body">  
                    <asp:Label ID="text" runat="server"></asp:Label> 
                </div> 
                <div class="sfComment2Bot"></div> 
                      
                 <class="sf_commentAuthor" style="padding-left:20px;">  
                    <strong style="color:#d81b1a">  
                        <asp:HyperLink ID="webSiteLink" runat="server" Visible="false" rel="nofollow"></asp:HyperLink> 
                        <asp:Literal runat="Server" ID="authorName"  Visible="false" ></asp:Literal>   
                    </strong> 
                    <%--<abbr class="date" id="commentDate" runat="server"</abbr>--%> 
                    <telerik:DateTimeLiteral ID="commentDateLiteral" runat="server" DateFormatString="f" /> 
                </p> 
                  
             </Template> 
              
           </sfWeb:CommentItem> 
              
        </ItemTemplate> 
        <FooterTemplate> 
            </ul> 
            </div> 
        </FooterTemplate> 
    </asp:Repeater> 
    <asp:PlaceHolder ID="moderationHolder" runat="server" Visible="false">  
        <class="sf_commentMessage">  
            <asp:Literal ID="Literal2" runat="server" Text="<%$Resources:CommentMessageModeration %>"></asp:Literal> 
        </p> 
    </asp:PlaceHolder> 
     
        <div class="sf_PostCommentHeader"></div> 
        <fieldset class="sf_postNewComment">  
              
            <ol> 
                <li> 
                    <asp:Label ID="Label2" runat="Server" Text="<%$Resources:Name %>" AssociatedControlID="authorTxt"></asp:Label> 
                    <asp:TextBox ID="authorTxt" runat="server" size="30"></asp:TextBox> 
                    <asp:RequiredFieldValidator runat="server" ID="authorVal" ControlToValidate="authorTxt" 
                            ErrorMessage="<%$Resources:NameEmpty %>" Display="dynamic"   
                            CssClass="sf_commentsValidator"></asp:RequiredFieldValidator> 
     
                </li> 
                <li> 
                    <asp:Label ID="Label3" runat="Server" Text="<%$Resources:Email %>" AssociatedControlID="emailTxt"></asp:Label> 
                    <asp:TextBox ID="emailTxt" runat="server" size="30"></asp:TextBox> 
                    <asp:RegularExpressionValidator runat="server" ID="emailVal" ControlToValidate="emailTxt" 
                            ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" ErrorMessage="<%$Resources:InvalidEmail %>" 
                            Display="dynamic" CssClass="sf_commentsValidator"></asp:RegularExpressionValidator> 
                </li> 
                <li> 
                    <asp:Label ID="Label4" runat="Server" Text="<%$Resources:WebSite %>" AssociatedControlID="webSiteTxt"></asp:Label> 
                    <asp:TextBox ID="webSiteTxt" runat="server" size="30"></asp:TextBox>   
                </li> 
                <li class="texarea-wrapper">  
                    <asp:Label ID="Label1" runat="Server" Text="<%$Resources:Comment %>" AssociatedControlID="commentTxt"></asp:Label> 
                    <div> 
                        <href="#" class="formattingOptionsToggleBtn" onclick='if($(this).parent().hasClass("formattingOptions")){$(this).parent().removeClass("formattingOptions");$(this).text("Formatting options");}else{$(this).parent().addClass("formattingOptions");$(this).text("Hide formatting options"); } return false;'>Formatting options</a> 
                         <telerik:RadEditor   
                                runat="server"   
                                ID="commentTxt" 
                                ToolsFile="~/Sitefinity/ControlTemplates/Blogs/ToolsFile.xml" 
                                EnableEmbeddedSkins="True"   
                                Skin="Default"   
                                Width="99%" 
                                Height="200px"   
                                EditModes="Design">              
                         </telerik:RadEditor>     
                    </div>    
                     <asp:RequiredFieldValidator runat="server" ID="contentVal"   
                            ControlToValidate="commentTxt" 
                            ErrorMessage="<%$Resources:CommentEmpty %>"   
                            Display="dynamic"   
                            ValidationGroup="commentInfo" 
                            CssClass="sf_commentsValidator">  
                            <strong>Message text is required</strong> 
                     </asp:RequiredFieldValidator>                                                                                                                      
                </li>             
                <li> 
                <sfWeb:SpamProtector id="spamProtector" runat="server" cssclass="commentsValidator hide" 
                    enableautobotdiscovery="true" enablehiddentextboxstrategy="true" 
                    hiddentextboxerrormessage="Hidden TextBox has some text in it!" hiddentextboxlabel="Do not fill this textbox!" 
                    hiddentextboxlabelcssclass="hide" hiddentextboxinputcssclass="hide" enablemintimeoutstrategy="true" 
                    mintimeout="2" mintimeouterrormessage="Submission too fast!" /> 
                <asp:Button ID="submitBtn" runat="server" Text="" 
                    CssClass="sf_commentSubmit" /> 
                </li> 
            </ol> 
        </fieldset> 
     
            </LayoutTemplate> 
        </sfWeb:BlogCommentsList> 
    </div> 
    <br /> 
     
    <div class="sf_dbComment">      
        <TN:ucPostAnonomously id="ucPostAnonomously1" runat="server" /> 
        <TN:ucSendFriend id="ucSendFriend1" runat="server" /> 
    </div> 
     
    <div class="sf_dbComment" visible="false" runat="server">  
        <asp:HyperLink cssclass="post-a-comment" ID="hplComment" runat="server"></asp:HyperLink>     
    </div> 
     

    Here is the ContentViewSingleItem.ascx.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.News.WebControls;  
    using Telerik.Cms.Web;  
    using Telerik.Cms.Engine;  
    using Telerik.Cms.Engine.ContentViewFiltering;  
    using System.Collections;  
    using Telerik.Blogs;  
    using DeepBlueCore;  
     
     
    public partial class Sitefinity_ControlTemplates_Blogs_ContentViewSingleItem : System.Web.UI.UserControl  
    {  
        #region Private contstraints  
        private Guid[] selectedBlogs = new Guid[] { };  
        private BlogManager blogManager;  
        #endregion   
     
        protected void Page_Load(object sender, EventArgs e)  
        {  
            CommentDetail();  
        }  
     
        #region[Comments]  
        private void CommentDetail()  
        {  
            #region[old]  
            //Telerik.Blogs.BlogManager manager = new Telerik.Blogs.BlogManager("Blogs");  
            //IList listOfAllBlogs = manager.GetBlogs();  
            //Guid selectedPostGuid = new Guid();  
            //string commentCount = "";  
     
            //foreach (IBlog blogItem in listOfAllBlogs)  
            //{  
            //    Guid parentId = blogItem.ID;  
            //    IList allposts = manager.GetPosts(string.Empty, parentId, parentId);  
     
            //    if (Common.QueryString("sessionid").Length > 0)  
            //    {  
            //        selectedPostGuid = new Guid(Common.QueryString("sessionid"));  
     
            //        foreach (IContent post in allposts)  
            //        {  
            //            if (post.ID == selectedPostGuid)  
            //            {  
            //                hplComment.NavigateUrl = string.Format("~/BlogComment/{0}", post.UrlWithExtension);  
     
            //                break;  
            //            }  
            //        }  
            //    }  
            //    else  
            //    {  
            //        if (Session["sessIContentGuid"] != null)  
            //        {  
            //            selectedPostGuid = new Guid(Session["sessIContentGuid"].ToString());  
     
            //            foreach (IContent post in allposts)  
            //            {  
            //                if (post.ID == selectedPostGuid)  
            //                {  
            //                    hplComment.NavigateUrl = string.Format("~/BlogComment/{0}", post.UrlWithExtension);  
            //                    GetReporterInfo((string)post.GetMetaData("Reporter"));  
            //                    break;  
            //                }  
            //            }  
            //        }  
            //    }  
            //}  
            #endregion  
     
            Telerik.Blogs.BlogManager manager = new Telerik.Blogs.BlogManager("Blogs");  
            IList listOfAllBlogs = manager.GetBlogs();  
            Guid selectedPostGuid = new Guid();  
            string commentCount = "";  
     
            foreach (IBlog blogItem in listOfAllBlogs)  
            {  
                Guid parentId = blogItem.ID;  
                IList allposts = manager.GetPosts(string.Empty, parentId, parentId);  
     
                if (Common.QueryString("searchid").Length > 0)  
                {  
                    selectedPostGuid = new Guid(Common.QueryString("searchid"));  
     
                    foreach (IContent post in allposts)  
                    {  
                        if (post.ID == selectedPostGuid)  
                        {  
                            if (!string.IsNullOrEmpty((string)post.GetMetaData("Reporter")))  
                            {  
                                GetReporterInfo((string)post.GetMetaData("Reporter"));  
                                break;  
                            }  
                            else  
                                sfReporterPhoto.Visible = false;  
                        }  
                    }  
                }  
                else  
                {  
                    if (Session["sessIContentGuid"] != null)  
                    {  
                        selectedPostGuid = new Guid(Session["sessIContentGuid"].ToString());  
     
                        foreach (IContent post in allposts)  
                        {  
                            if (post.ID == selectedPostGuid)  
                            {  
                                if (!string.IsNullOrEmpty((string)post.GetMetaData("Reporter")))  
                                {  
                                    GetReporterInfo((string)post.GetMetaData("Reporter"));  
                                    break;  
                                }  
                                else  
                                    sfReporterPhoto.Visible = false;  
                            }  
                        }  
                    }  
                }  
            }  
        }  
        #endregion  
     
        #region[Reporter Info]  
        private void GetReporterInfo(string contentID)  
        {  
            if (contentID.Length > 0)  
            {  
                Guid contentGuid = new Guid(contentID);  
     
                // create new instance of ContentManager  
                Telerik.Cms.Engine.ContentManager contentManager = new Telerik.Cms.Engine.ContentManager();  
     
                // get all content items  
                IList listOfContentItems = contentManager.GetContent();  
                if (listOfContentItems.Count > 0)  
                {  
                    foreach (IContent iContent in listOfContentItems)  
                    {  
                        if (iContent.ID == contentGuid)  
                        {  
                            string reporterPhoto = (string)iContent.GetMetaData("ReporterPhoto");  
                            lAuthorName.Text = (string)iContent.GetMetaData("Name");  
                            lAuthorName2.Text = (string)iContent.GetMetaData("Name");  
                            hpAuthorBioURL.NavigateUrl = string.Format("~/Reporters.aspx?rpt={0}",iContent.ID.ToString());  
                            hpAuthorBioURL.Text = "READ BIOGRAPHY";  
                            ReporterCaption.Text = (string)iContent.GetMetaData("ReporterCaption");  
                            ReporterCaption2.Text = (string)iContent.GetMetaData("ReporterCaption");  
     
                            if (reporterPhoto.Length > 0)  
                                sfReporterPhoto.ImageUrl = string.Format("{0}", reporterPhoto);  
                            else  
                                sfReporterPhoto.Visible = false;  
     
                            break;  
                        }  
                    }  
                }  
            }  
        }  
        #endregion  
     
        public Guid[] SelectedBlogs  
        {  
            get  
            {  
                return this.selectedBlogs;  
            }  
            set  
            {  
                this.selectedBlogs = value;  
            }  
        }    
     
     
          
    }  
     

    Now what I want to do is add a hyperlink to a different page (let's call it NoPictures.aspx) and have it display the exact same data that is being displayed in the ContentViewSingleItem. What is the best way to do this? I hope I explained this well.

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    21 Jan 2010
    Link to this post
    Hi Steven Lancaster,

    I think think that we have already discussed this several times in another posts. You gave to add a button to the control you have already create when clicked redirect to NoPictures.aspx, pass the content item ID through QueryString, Session, cookie.


    1. On the other page NoPictures.aspx add some control - custom or just BlogPosts that will show the content item
    2. Pass the content item ID through QueryString, Session, cookie from the button you should have on ContentViewSingleItem.ascx
    3. Read the QueryString, session or cookie and call ContentManager("Blogs"), get the content and display it.

    ContentViewSingleItem.ascx


    void Button1_Click(object sender, EventArgs e)
      {
     
          Session["PostID"] = contentItem.ID
          Response.Redirect("~/NoPictures.aspx");
      }

    you should have this logic on NoPictures.aspx

    protected void Page_Load(object sender, EventArgs e)
       {
           Guid itemID = (Guid)Session["PostID"];
           var manager = ContentManager("Blogs");
           IContent cnt = manager.GetContent(itemID);
       }


    Best wishes,
    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. Steven Lancaster
    Steven Lancaster avatar
    82 posts
    Registered:
    06 Nov 2009
    24 Jan 2010
    Link to this post
    I am getting the following error using that code.

     

    Server Error in '/' Application.

    Compilation Error

    Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

    Compiler Error Message: CS0103: The name 'contentItem' does not exist in the current context

    Source Error:

    Line 15:     {
    Line 16: 
    Line 17: Session["PostID"] = contentItem.ID;Line 18:         Response.Redirect("~/NoPictures.aspx");
    Line 19:     }

    Source File: c:\Inetpub\wwwroot\TheNerve\Sitefinity\ControlTemplates\Blogs\ContentViewSingleItem.ascx    Line: 17


    Here is the ContentViewSingleItem.ascx

    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="ContentViewSingleItem.ascx.cs" Inherits="Sitefinity_ControlTemplates_Blogs_ContentViewSingleItem" %> 
    <%@ Register Assembly="Telerik.Cms.Engine" Namespace="Telerik.Cms.Engine.WebControls" TagPrefix="sfWeb" %> 
    <%@ Register Assembly="Telerik.Cms.Web.UI" Namespace="Telerik.Web.UI.SpamProtection" TagPrefix="sfWeb" %> 
    <%@ Register Assembly="Telerik.Cms.Web.UI" Namespace="Telerik.Cms.Web.UI" TagPrefix="sfWeb" %> 
    <%@ Register Assembly="Telerik.Blogs" Namespace="Telerik.Blogs.WebControls" TagPrefix="sfWeb" %> 
    <%@ Register TagPrefix="sf" Assembly="Telerik.Cms.Engine" Namespace="Telerik.Cms.Engine.WebControls" %> 
    <%@ Register TagPrefix="TN" TagName="ucPostAnonomously" Src="~/Sitefinity/ControlTemplates/Blogs/ucPostAnonomously.ascx" %> 
    <%@ Register TagPrefix="TN" TagName="ucSendFriend" Src="~/Sitefinity/ControlTemplates/Blogs/ucSendFriend.ascx" %> 
     
    <telerik:CssFileLink ID="CssFileLink1" EmbeddedFileName="Telerik.Blogs.Resources.ControlTemplates.Frontend.blogsCommonLayout.css" FileName="" Media="screen" runat="server" /> 
    <telerik:JsFileLink id="jsLink" runat="server" ScriptType="jQuery" />   
     
    <script runat="server">  
        void Button1_Click(object sender, EventArgs e)  
        {  
     
            Session["PostID"] = contentItem.ID;  
            Response.Redirect("~/NoPictures.aspx");  
        }  
    </script> 
    <asp:PlaceHolder ID="trackbackScript" runat="server">  
     
    </asp:PlaceHolder> 
     
    <div class="sf_singlePost">  
    <asp:Label ID="AuthorPhoto" runat="server" Visible="false"></asp:Label> 
        <asp:Label ID="AuthorName" runat="server" Visible="false"></asp:Label> 
        <asp:Label ID="AuthorBioURL" runat="server" Visible="false"></asp:Label> 
          
        <%--<class="sf_back">  
           <asp:HyperLink ID="backToList1" Text="<%$Resources:GoBack %>" runat="server"></asp:HyperLink>   
        </p>--%> 
     
       <h1 class="sf_postTitle">  
            <asp:Literal ID="Title" runat="server"></asp:Literal> 
        </h1> 
        <form id="form1> 
            <asp:Button ID="Button1" runat="server" Text="See No Pics" OnClick="Button1_Click" />      
        </form>      
         <!-- post author :begin--> 
        <div class="post-author">  
            <span class="a-img-bg"><sfWeb:SitefinityImage  ID="sfReporterPhoto" runat="server" Width="176px" Height="199px"  /></span><span class="a-name"><asp:Literal ID="lAuthorName" runat="server"></asp:Literal></span>  
            <class="a-desc"><asp:Literal ID="ReporterCaption" runat="server"></asp:Literal></p>  
            <asp:HyperLink ID="hpAuthorBioURL" runat="server" ></asp:HyperLink> 
         </div> 
        <!-- post author :end--> 
          
       <class="sf_postAuthor">  
            <%--<asp:Literal ID="Literal3" runat="server" Text="<%$Resources:Author %>"></asp:Literal> 
            <asp:HyperLink ID="postedBy" runat="server">  
                <asp:Literal ID="Author" runat="server"></asp:Literal> 
            </asp:HyperLink>--%> 
            Written By: <asp:Literal ID="lAuthorName2" runat="server"></asp:Literal> 
        </p> 
       <class="sf_postAuthor">  
                &nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
                <asp:Literal ID="ReporterCaption2" runat="server"></asp:Literal> 
        </p> 
        <class="sf_postDate">  
            <telerik:DateTimeLiteral runat="server" ID="Publication_Date" DateFormatString="D"></telerik:DateTimeLiteral> 
        </p> 
        <asp:Panel ID="pnlContent" runat="server" CssClass="sf_postContent">  
            <asp:Literal ID="content" runat="server"></asp:Literal> 
        </asp:Panel> 
         <%--<class="sf_postCategory">  
            <asp:Literal ID="CategoryLiteral" runat="server" Text="<%$Resources:Category %>" /><asp:HyperLink ID="Category" runat="server" /> 
         </p>--%> 
         <class="sf_postTags">  
              
            <asp:Repeater ID="Tags" runat="server">  
                <HeaderTemplate> 
                    <asp:Literal ID="TagsLiteral" runat="server" Text="<%$Resources:Tags %>" /> 
                </HeaderTemplate> 
                <ItemTemplate> 
                    <asp:HyperLink ID="tagLink" runat="server" /> 
                </ItemTemplate> 
            </asp:Repeater> 
        </p> 
          
        <asp:Repeater ID="Bookmarks" runat="server">  
            <HeaderTemplate><ul class="sf_socialBookmarks"></HeaderTemplate> 
            <ItemTemplate> 
                <li> 
                    <asp:HyperLink ID="BookmarkLink" runat="server">  
                        <asp:Image ID="BookmarkImage" runat="server" /> 
                    </asp:HyperLink> 
                </li> 
            </ItemTemplate>    
            <FooterTemplate></ul></FooterTemplate> 
        </asp:Repeater>    
          
    </div> 
     
     
    <div class="">  
        <sfWeb:BlogCommentsList ID="commentsList" runat="server" CssClass="sf_commentsList" ValidationGroup="commentInfo">  
                  <LayoutTemplate> 
            <asp:Repeater ID="commentsRepeater" runat="Server" > 
              
        <HeaderTemplate> 
            <asp:PlaceHolder runat="server" ID="headerHolder" Visible="true">  
                <h2 class="sf_comments" style="padding-left:15px;">  
                    <asp:Literal ID="Literal1" runat="server" Text="<%$Resources:Comments %>" /> 
                    (<asp:Literal ID="commentsCount" runat="server"></asp:Literal>)  
                </h2>   
            </asp:PlaceHolder>        
            <div class="sf_dbComment">  
            <ul class="sf_commentListing">  
        </HeaderTemplate> 
        <ItemTemplate>   
            <!-- comment goes here --> 
            <sfWeb:CommentItem Id="anonCommentContainer" runat="server" CssClass="sf_anonymousComment" >   
              
             <Template> 
                  
                    <div class="sfComment1Top"></div> 
                    <div class="sfComment1Body">  
                        <asp:Label ID="text" runat="server"></asp:Label> 
                    </div> 
                    <div class="sfComment1Bot"></div>             
                 
                   <class="sf_commentAuthor" style="padding-left:20px;">  
                        <strong style="color:#d81b1a">  
                            <asp:HyperLink ID="webSiteLink" runat="server" Visible="false" rel="nofollow"></asp:HyperLink> 
                            <asp:Literal runat="Server" ID="authorName"  Visible="false"></asp:Literal>   
                        </strong> 
                        <%--<abbr class="date" id="commentDate" runat="server" > </abbr>--%> 
                        <telerik:DateTimeLiteral ID="commentDateLiteral" runat="server" DateFormatString="f" /> 
                    </p> 
                  
            </Template> 
             
            </sfWeb:CommentItem> 
             
            <sfWeb:CommentItem Id="authorCommentContainer" runat="server"  CssClass="">   
             <Template> 
                <div class="sfComment2Top"></div> 
                <div class="sfComment2Body">  
                    <asp:Label ID="text" runat="server"></asp:Label> 
                </div> 
                <div class="sfComment2Bot"></div> 
                      
                 <class="sf_commentAuthor" style="padding-left:20px;">  
                    <strong style="color:#d81b1a">  
                        <asp:HyperLink ID="webSiteLink" runat="server" Visible="false" rel="nofollow"></asp:HyperLink> 
                        <asp:Literal runat="Server" ID="authorName"  Visible="false" ></asp:Literal>   
                    </strong> 
                    <%--<abbr class="date" id="commentDate" runat="server"</abbr>--%> 
                    <telerik:DateTimeLiteral ID="commentDateLiteral" runat="server" DateFormatString="f" /> 
                </p> 
                  
             </Template> 
              
           </sfWeb:CommentItem> 
              
        </ItemTemplate> 
        <FooterTemplate> 
            </ul> 
            </div> 
        </FooterTemplate> 
    </asp:Repeater> 
    <asp:PlaceHolder ID="moderationHolder" runat="server" Visible="false">  
        <class="sf_commentMessage">  
            <asp:Literal ID="Literal2" runat="server" Text="<%$Resources:CommentMessageModeration %>"></asp:Literal> 
        </p> 
    </asp:PlaceHolder> 
     
        <div class="sf_PostCommentHeader"></div> 
        <fieldset class="sf_postNewComment">  
              
            <ol> 
                <li> 
                    <asp:Label ID="Label2" runat="Server" Text="<%$Resources:Name %>" AssociatedControlID="authorTxt"></asp:Label> 
                    <asp:TextBox ID="authorTxt" runat="server" size="30"></asp:TextBox> 
                    <asp:RequiredFieldValidator runat="server" ID="authorVal" ControlToValidate="authorTxt" 
                            ErrorMessage="<%$Resources:NameEmpty %>" Display="dynamic"   
                            CssClass="sf_commentsValidator"></asp:RequiredFieldValidator> 
     
                </li> 
                <li> 
                    <asp:Label ID="Label3" runat="Server" Text="<%$Resources:Email %>" AssociatedControlID="emailTxt"></asp:Label> 
                    <asp:TextBox ID="emailTxt" runat="server" size="30"></asp:TextBox> 
                    <asp:RegularExpressionValidator runat="server" ID="emailVal" ControlToValidate="emailTxt" 
                            ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" ErrorMessage="<%$Resources:InvalidEmail %>" 
                            Display="dynamic" CssClass="sf_commentsValidator"></asp:RegularExpressionValidator> 
                </li> 
                <li> 
                    <asp:Label ID="Label4" runat="Server" Text="<%$Resources:WebSite %>" AssociatedControlID="webSiteTxt"></asp:Label> 
                    <asp:TextBox ID="webSiteTxt" runat="server" size="30"></asp:TextBox>   
                </li> 
                <li class="texarea-wrapper">  
                    <asp:Label ID="Label1" runat="Server" Text="<%$Resources:Comment %>" AssociatedControlID="commentTxt"></asp:Label> 
                    <div> 
                        <href="#" class="formattingOptionsToggleBtn" onclick='if($(this).parent().hasClass("formattingOptions")){$(this).parent().removeClass("formattingOptions");$(this).text("Formatting options");}else{$(this).parent().addClass("formattingOptions");$(this).text("Hide formatting options"); } return false;'>Formatting options</a> 
                         <telerik:RadEditor   
                                runat="server"   
                                ID="commentTxt" 
                                ToolsFile="~/Sitefinity/ControlTemplates/Blogs/ToolsFile.xml" 
                                EnableEmbeddedSkins="True"   
                                Skin="Default"   
                                Width="99%" 
                                Height="200px"   
                                EditModes="Design">              
                         </telerik:RadEditor>     
                    </div>    
                     <asp:RequiredFieldValidator runat="server" ID="contentVal"   
                            ControlToValidate="commentTxt" 
                            ErrorMessage="<%$Resources:CommentEmpty %>"   
                            Display="dynamic"   
                            ValidationGroup="commentInfo" 
                            CssClass="sf_commentsValidator">  
                            <strong>Message text is required</strong> 
                     </asp:RequiredFieldValidator>                                                                                                                      
                </li>             
                <li> 
                <sfWeb:SpamProtector id="spamProtector" runat="server" cssclass="commentsValidator hide" 
                    enableautobotdiscovery="true" enablehiddentextboxstrategy="true" 
                    hiddentextboxerrormessage="Hidden TextBox has some text in it!" hiddentextboxlabel="Do not fill this textbox!" 
                    hiddentextboxlabelcssclass="hide" hiddentextboxinputcssclass="hide" enablemintimeoutstrategy="true" 
                    mintimeout="2" mintimeouterrormessage="Submission too fast!" /> 
                <asp:Button ID="submitBtn" runat="server" Text="" 
                    CssClass="sf_commentSubmit" /> 
                </li> 
            </ol> 
        </fieldset> 
     
            </LayoutTemplate> 
        </sfWeb:BlogCommentsList> 
    </div> 
    <br /> 
     
    <div class="sf_dbComment">      
        <TN:ucPostAnonomously id="ucPostAnonomously1" runat="server" /> 
        <TN:ucSendFriend id="ucSendFriend1" runat="server" /> 
    </div> 
     
    <div class="sf_dbComment" visible="false" runat="server">  
        <asp:HyperLink cssclass="post-a-comment" ID="hplComment" runat="server"></asp:HyperLink>     
    </div> 
     


    Here is the ContentViewSingleItem.ascx.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.News.WebControls;  
    using Telerik.Cms.Web;  
    using Telerik.Cms.Engine;  
    using Telerik.Cms.Engine.ContentViewFiltering;  
    using System.Collections;  
    using Telerik.Blogs;  
    using DeepBlueCore;  
     
     
    public partial class Sitefinity_ControlTemplates_Blogs_ContentViewSingleItem : System.Web.UI.UserControl  
    {  
     
        #region Private contstraints  
        private Guid[] selectedBlogs = new Guid[] { };  
        private BlogManager blogManager;  
        #endregion   
     
        protected void Page_Load(object sender, EventArgs e)  
        {  
            CommentDetail();  
        }  
     
        #region[Comments]  
        private void CommentDetail()  
        {  
            #region[old]  
            //Telerik.Blogs.BlogManager manager = new Telerik.Blogs.BlogManager("Blogs");  
            //IList listOfAllBlogs = manager.GetBlogs();  
            //Guid selectedPostGuid = new Guid();  
            //string commentCount = "";  
     
            //foreach (IBlog blogItem in listOfAllBlogs)  
            //{  
            //    Guid parentId = blogItem.ID;  
            //    IList allposts = manager.GetPosts(string.Empty, parentId, parentId);  
     
            //    if (Common.QueryString("sessionid").Length > 0)  
            //    {  
            //        selectedPostGuid = new Guid(Common.QueryString("sessionid"));  
     
            //        foreach (IContent post in allposts)  
            //        {  
            //            if (post.ID == selectedPostGuid)  
            //            {  
            //                hplComment.NavigateUrl = string.Format("~/BlogComment/{0}", post.UrlWithExtension);  
     
            //                break;  
            //            }  
            //        }  
            //    }  
            //    else  
            //    {  
            //        if (Session["sessIContentGuid"] != null)  
            //        {  
            //            selectedPostGuid = new Guid(Session["sessIContentGuid"].ToString());  
     
            //            foreach (IContent post in allposts)  
            //            {  
            //                if (post.ID == selectedPostGuid)  
            //                {  
            //                    hplComment.NavigateUrl = string.Format("~/BlogComment/{0}", post.UrlWithExtension);  
            //                    GetReporterInfo((string)post.GetMetaData("Reporter"));  
            //                    break;  
            //                }  
            //            }  
            //        }  
            //    }  
            //}  
            #endregion  
     
            Telerik.Blogs.BlogManager manager = new Telerik.Blogs.BlogManager("Blogs");  
            IList listOfAllBlogs = manager.GetBlogs();  
            Guid selectedPostGuid = new Guid();  
            string commentCount = "";  
     
            foreach (IBlog blogItem in listOfAllBlogs)  
            {  
                Guid parentId = blogItem.ID;  
                IList allposts = manager.GetPosts(string.Empty, parentId, parentId);  
     
                if (Common.QueryString("searchid").Length > 0)  
                {  
                    selectedPostGuid = new Guid(Common.QueryString("searchid"));  
     
                    foreach (IContent post in allposts)  
                    {  
                        if (post.ID == selectedPostGuid)  
                        {  
                            if (!string.IsNullOrEmpty((string)post.GetMetaData("Reporter")))  
                            {  
                                GetReporterInfo((string)post.GetMetaData("Reporter"));  
                                break;  
                            }  
                            else  
                                sfReporterPhoto.Visible = false;  
                        }  
                    }  
                }  
                else  
                {  
                    if (Session["sessIContentGuid"] != null)  
                    {  
                        selectedPostGuid = new Guid(Session["sessIContentGuid"].ToString());  
     
                        foreach (IContent post in allposts)  
                        {  
                            if (post.ID == selectedPostGuid)  
                            {  
                                if (!string.IsNullOrEmpty((string)post.GetMetaData("Reporter")))  
                                {  
                                    GetReporterInfo((string)post.GetMetaData("Reporter"));  
                                    break;  
                                }  
                                else  
                                    sfReporterPhoto.Visible = false;  
                            }  
                        }  
                    }  
                }  
            }  
        }  
        #endregion  
     
        #region[Reporter Info]  
        private void GetReporterInfo(string contentID)  
        {  
            if (contentID.Length > 0)  
            {  
                Guid contentGuid = new Guid(contentID);  
     
                // create new instance of ContentManager  
                Telerik.Cms.Engine.ContentManager contentManager = new Telerik.Cms.Engine.ContentManager();  
     
                // get all content items  
                IList listOfContentItems = contentManager.GetContent();  
                if (listOfContentItems.Count > 0)  
                {  
                    foreach (IContent iContent in listOfContentItems)  
                    {  
                        if (iContent.ID == contentGuid)  
                        {  
                            string reporterPhoto = (string)iContent.GetMetaData("ReporterPhoto");  
                            lAuthorName.Text = (string)iContent.GetMetaData("Name");  
                            lAuthorName2.Text = (string)iContent.GetMetaData("Name");  
                            hpAuthorBioURL.NavigateUrl = string.Format("~/Reporters.aspx?rpt={0}",iContent.ID.ToString());  
                            hpAuthorBioURL.Text = "READ BIOGRAPHY";  
                            ReporterCaption.Text = (string)iContent.GetMetaData("ReporterCaption");  
                            ReporterCaption2.Text = (string)iContent.GetMetaData("ReporterCaption");  
     
                            if (reporterPhoto.Length > 0)  
                                sfReporterPhoto.ImageUrl = string.Format("{0}", reporterPhoto);  
                            else  
                                sfReporterPhoto.Visible = false;  
     
                            break;  
                        }  
                    }  
                }  
            }  
        }  
        #endregion  
     
        public Guid[] SelectedBlogs  
        {  
            get  
            {  
                return this.selectedBlogs;  
            }  
            set  
            {  
                this.selectedBlogs = value;  
            }  
        }    
     
     
          
    }  
     

    Do you see any obvious issues?








  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    24 Jan 2010
    Link to this post
    Hello Steven Lancaster,

    There is no object "contentItem" in the code you have created.

    Kind regards,
    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.
  5. Steven Lancaster
    Steven Lancaster avatar
    82 posts
    Registered:
    06 Nov 2009
    25 Jan 2010
    Link to this post
    I am still having issues. I am uploading my files in a zip file. Can you look at it and tell what might be my problem?

    ContentViewSingleItem.ascx.cs

    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="ContentViewSingleItem.ascx.cs" Inherits="Sitefinity_ControlTemplates_Blogs_ContentViewSingleItem" %> 
    <%@ Register Assembly="Telerik.Cms.Engine" Namespace="Telerik.Cms.Engine.WebControls" TagPrefix="sfWeb" %> 
    <%@ Register Assembly="Telerik.Cms.Web.UI" Namespace="Telerik.Web.UI.SpamProtection" TagPrefix="sfWeb" %> 
    <%@ Register Assembly="Telerik.Cms.Web.UI" Namespace="Telerik.Cms.Web.UI" TagPrefix="sfWeb" %> 
    <%@ Register Assembly="Telerik.Blogs" Namespace="Telerik.Blogs.WebControls" TagPrefix="sfWeb" %> 
    <%@ Register TagPrefix="sf" Assembly="Telerik.Cms.Engine" Namespace="Telerik.Cms.Engine.WebControls" %> 
    <%@ Register TagPrefix="TN" TagName="ucPostAnonomously" Src="~/Sitefinity/ControlTemplates/Blogs/ucPostAnonomously.ascx" %> 
    <%@ Register TagPrefix="TN" TagName="ucSendFriend" Src="~/Sitefinity/ControlTemplates/Blogs/ucSendFriend.ascx" %> 
     
    <telerik:CssFileLink ID="CssFileLink1" EmbeddedFileName="Telerik.Blogs.Resources.ControlTemplates.Frontend.blogsCommonLayout.css" FileName="" Media="screen" runat="server" /> 
    <telerik:JsFileLink id="jsLink" runat="server" ScriptType="jQuery" />   
     
    <script runat="server">  
        void Button1_Click(object sender, EventArgs e)  
        {         
            Session["PostID"] = content.ID;  
            Response.Redirect("~/printFriendly.aspx");  
              
        }  
     
    </script> 
     
    <asp:PlaceHolder ID="trackbackScript" runat="server">  
    </asp:PlaceHolder> 
     
    <div class="sf_singlePost">  
    <asp:Label ID="AuthorPhoto" runat="server" Visible="false"></asp:Label> 
        <asp:Label ID="AuthorName" runat="server" Visible="false"></asp:Label> 
        <asp:Label ID="AuthorBioURL" runat="server" Visible="false"></asp:Label> 
     
            <asp:Button ID="Button1" runat="server" Text="Printer Friendly" OnClick="Button1_Click" /> 
        <%--<class="sf_back">  
           <asp:HyperLink ID="backToList1" Text="<%$Resources:GoBack %>" runat="server"></asp:HyperLink>   
        </p>--%> 
     
       <h1 class="sf_postTitle">  
            <asp:Literal ID="Title" runat="server"></asp:Literal> 
        </h1> 
         <!-- post author :begin--> 
        <div class="post-author">  
            <span class="a-img-bg"><sfWeb:SitefinityImage  ID="sfReporterPhoto" runat="server" Width="176px" Height="199px"  /></span><span class="a-name"><asp:Literal ID="lAuthorName" runat="server"></asp:Literal></span>  
            <class="a-desc"><asp:Literal ID="ReporterCaption" runat="server"></asp:Literal></p>  
            <asp:HyperLink ID="hpAuthorBioURL" runat="server" ></asp:HyperLink> 
         </div> 
        <!-- post author :end--> 
          
       <class="sf_postAuthor">  
            <%--<asp:Literal ID="Literal3" runat="server" Text="<%$Resources:Author %>"></asp:Literal> 
            <asp:HyperLink ID="postedBy" runat="server">  
                <asp:Literal ID="Author" runat="server"></asp:Literal> 
            </asp:HyperLink>--%> 
            Written By: <asp:Literal ID="lAuthorName2" runat="server"></asp:Literal> 
        </p> 
       <class="sf_postAuthor">  
                &nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
                <asp:Literal ID="ReporterCaption2" runat="server"></asp:Literal> 
        </p> 
        <class="sf_postDate">  
            <telerik:DateTimeLiteral runat="server" ID="Publication_Date" DateFormatString="D"></telerik:DateTimeLiteral> 
        </p> 
        <asp:Panel ID="pnlContent" runat="server" CssClass="sf_postContent">  
            <asp:Literal ID="content" runat="server"></asp:Literal> 
        </asp:Panel> 
         <%--<class="sf_postCategory">  
            <asp:Literal ID="CategoryLiteral" runat="server" Text="<%$Resources:Category %>" /><asp:HyperLink ID="Category" runat="server" /> 
         </p>--%> 
         <class="sf_postTags">  
              
            <asp:Repeater ID="Tags" runat="server">  
                <HeaderTemplate> 
                    <asp:Literal ID="TagsLiteral" runat="server" Text="<%$Resources:Tags %>" /> 
                </HeaderTemplate> 
                <ItemTemplate> 
                    <asp:HyperLink ID="tagLink" runat="server" /> 
                </ItemTemplate> 
            </asp:Repeater> 
        </p> 
          
        <asp:Repeater ID="Bookmarks" runat="server">  
            <HeaderTemplate><ul class="sf_socialBookmarks"></HeaderTemplate> 
            <ItemTemplate> 
                <li> 
                    <asp:HyperLink ID="BookmarkLink" runat="server">  
                        <asp:Image ID="BookmarkImage" runat="server" /> 
                    </asp:HyperLink> 
                </li> 
            </ItemTemplate>    
            <FooterTemplate></ul></FooterTemplate> 
        </asp:Repeater>    
          
    </div> 
     
     
    <div class="">  
        <sfWeb:BlogCommentsList ID="commentsList" runat="server" CssClass="sf_commentsList" ValidationGroup="commentInfo">  
                  <LayoutTemplate> 
            <asp:Repeater ID="commentsRepeater" runat="Server" > 
              
        <HeaderTemplate> 
            <asp:PlaceHolder runat="server" ID="headerHolder" Visible="true">  
                <h2 class="sf_comments" style="padding-left:15px;">  
                    <asp:Literal ID="Literal1" runat="server" Text="<%$Resources:Comments %>" /> 
                    (<asp:Literal ID="commentsCount" runat="server"></asp:Literal>)  
                </h2>   
            </asp:PlaceHolder>        
            <div class="sf_dbComment">  
            <ul class="sf_commentListing">  
        </HeaderTemplate> 
        <ItemTemplate>   
            <!-- comment goes here --> 
            <sfWeb:CommentItem Id="anonCommentContainer" runat="server" CssClass="sf_anonymousComment" >   
              
             <Template> 
                  
                    <div class="sfComment1Top"></div> 
                    <div class="sfComment1Body">  
                        <asp:Label ID="text" runat="server"></asp:Label> 
                    </div> 
                    <div class="sfComment1Bot"></div>             
                 
                   <class="sf_commentAuthor" style="padding-left:20px;">  
                        <strong style="color:#d81b1a">  
                            <asp:HyperLink ID="webSiteLink" runat="server" Visible="false" rel="nofollow"></asp:HyperLink> 
                            <asp:Literal runat="Server" ID="authorName"  Visible="false"></asp:Literal>   
                        </strong> 
                        <%--<abbr class="date" id="commentDate" runat="server" > </abbr>--%> 
                        <telerik:DateTimeLiteral ID="commentDateLiteral" runat="server" DateFormatString="f" /> 
                    </p> 
                  
            </Template> 
             
            </sfWeb:CommentItem> 
             
            <sfWeb:CommentItem Id="authorCommentContainer" runat="server"  CssClass="">   
             <Template> 
                <div class="sfComment2Top"></div> 
                <div class="sfComment2Body">  
                    <asp:Label ID="text" runat="server"></asp:Label> 
                </div> 
                <div class="sfComment2Bot"></div> 
                      
                 <class="sf_commentAuthor" style="padding-left:20px;">  
                    <strong style="color:#d81b1a">  
                        <asp:HyperLink ID="webSiteLink" runat="server" Visible="false" rel="nofollow"></asp:HyperLink> 
                        <asp:Literal runat="Server" ID="authorName"  Visible="false" ></asp:Literal>   
                    </strong> 
                    <%--<abbr class="date" id="commentDate" runat="server"</abbr>--%> 
                    <telerik:DateTimeLiteral ID="commentDateLiteral" runat="server" DateFormatString="f" /> 
                </p> 
                  
             </Template> 
              
           </sfWeb:CommentItem> 
              
        </ItemTemplate> 
        <FooterTemplate> 
            </ul> 
            </div> 
        </FooterTemplate> 
    </asp:Repeater> 
    <asp:PlaceHolder ID="moderationHolder" runat="server" Visible="false">  
        <class="sf_commentMessage">  
            <asp:Literal ID="Literal2" runat="server" Text="<%$Resources:CommentMessageModeration %>"></asp:Literal> 
        </p> 
    </asp:PlaceHolder> 
     
        <div class="sf_PostCommentHeader"></div> 
        <fieldset class="sf_postNewComment">  
              
            <ol> 
                <li> 
                    <asp:Label ID="Label2" runat="Server" Text="<%$Resources:Name %>" AssociatedControlID="authorTxt"></asp:Label> 
                    <asp:TextBox ID="authorTxt" runat="server" size="30"></asp:TextBox> 
                    <asp:RequiredFieldValidator runat="server" ID="authorVal" ControlToValidate="authorTxt" 
                            ErrorMessage="<%$Resources:NameEmpty %>" Display="dynamic"   
                            CssClass="sf_commentsValidator"></asp:RequiredFieldValidator> 
     
                </li> 
                <li> 
                    <asp:Label ID="Label3" runat="Server" Text="<%$Resources:Email %>" AssociatedControlID="emailTxt"></asp:Label> 
                    <asp:TextBox ID="emailTxt" runat="server" size="30"></asp:TextBox> 
                    <asp:RegularExpressionValidator runat="server" ID="emailVal" ControlToValidate="emailTxt" 
                            ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" ErrorMessage="<%$Resources:InvalidEmail %>" 
                            Display="dynamic" CssClass="sf_commentsValidator"></asp:RegularExpressionValidator> 
                </li> 
                <li> 
                    <asp:Label ID="Label4" runat="Server" Text="<%$Resources:WebSite %>" AssociatedControlID="webSiteTxt"></asp:Label> 
                    <asp:TextBox ID="webSiteTxt" runat="server" size="30"></asp:TextBox>   
                </li> 
                <li class="texarea-wrapper">  
                    <asp:Label ID="Label1" runat="Server" Text="<%$Resources:Comment %>" AssociatedControlID="commentTxt"></asp:Label> 
                    <div> 
                        <href="#" class="formattingOptionsToggleBtn" onclick='if($(this).parent().hasClass("formattingOptions")){$(this).parent().removeClass("formattingOptions");$(this).text("Formatting options");}else{$(this).parent().addClass("formattingOptions");$(this).text("Hide formatting options"); } return false;'>Formatting options</a> 
                         <telerik:RadEditor   
                                runat="server"   
                                ID="commentTxt" 
                                ToolsFile="~/Sitefinity/ControlTemplates/Blogs/ToolsFile.xml" 
                                EnableEmbeddedSkins="True"   
                                Skin="Default"   
                                Width="99%" 
                                Height="200px"   
                                EditModes="Design">              
                         </telerik:RadEditor>     
                    </div>    
                     <asp:RequiredFieldValidator runat="server" ID="contentVal"   
                            ControlToValidate="commentTxt" 
                            ErrorMessage="<%$Resources:CommentEmpty %>"   
                            Display="dynamic"   
                            ValidationGroup="commentInfo" 
                            CssClass="sf_commentsValidator">  
                            <strong>Message text is required</strong> 
                     </asp:RequiredFieldValidator>                                                                                                                      
                </li>             
                <li> 
                <sfWeb:SpamProtector id="spamProtector" runat="server" cssclass="commentsValidator hide" 
                    enableautobotdiscovery="true" enablehiddentextboxstrategy="true" 
                    hiddentextboxerrormessage="Hidden TextBox has some text in it!" hiddentextboxlabel="Do not fill this textbox!" 
                    hiddentextboxlabelcssclass="hide" hiddentextboxinputcssclass="hide" enablemintimeoutstrategy="true" 
                    mintimeout="2" mintimeouterrormessage="Submission too fast!" /> 
                <asp:Button ID="submitBtn" runat="server" Text="" 
                    CssClass="sf_commentSubmit" /> 
                </li> 
            </ol> 
        </fieldset> 
     
            </LayoutTemplate> 
        </sfWeb:BlogCommentsList> 
    </div> 
    <br /> 
     
    <div class="sf_dbComment">      
        <TN:ucPostAnonomously id="ucPostAnonomously1" runat="server" /> 
        <TN:ucSendFriend id="ucSendFriend1" runat="server" /> 
    </div> 
     
    <div class="sf_dbComment" visible="false" runat="server">  
        <asp:HyperLink cssclass="post-a-comment" ID="hplComment" runat="server"></asp:HyperLink>     
    </div> 
     

    ContentViewSingleItem.ascx.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.News.WebControls;  
    using Telerik.Cms.Web;  
    using Telerik.Cms.Engine;  
    using Telerik.Cms.Engine.ContentViewFiltering;  
    using System.Collections;  
    using Telerik.Blogs;  
    using DeepBlueCore;  
     
     
    public partial class Sitefinity_ControlTemplates_Blogs_ContentViewSingleItem : System.Web.UI.UserControl  
    {  
     
        #region Private contstraints  
        private Guid[] selectedBlogs = new Guid[] { };  
        private BlogManager blogManager;  
        #endregion   
     
        protected void Page_Load(object sender, EventArgs e)  
        {  
            CommentDetail();  
        }  
     
        #region[Comments]  
        private void CommentDetail()  
        {  
            #region[old]  
            //Telerik.Blogs.BlogManager manager = new Telerik.Blogs.BlogManager("Blogs");  
            //IList listOfAllBlogs = manager.GetBlogs();  
            //Guid selectedPostGuid = new Guid();  
            //string commentCount = "";  
     
            //foreach (IBlog blogItem in listOfAllBlogs)  
            //{  
            //    Guid parentId = blogItem.ID;  
            //    IList allposts = manager.GetPosts(string.Empty, parentId, parentId);  
     
            //    if (Common.QueryString("sessionid").Length > 0)  
            //    {  
            //        selectedPostGuid = new Guid(Common.QueryString("sessionid"));  
     
            //        foreach (IContent post in allposts)  
            //        {  
            //            if (post.ID == selectedPostGuid)  
            //            {  
            //                hplComment.NavigateUrl = string.Format("~/BlogComment/{0}", post.UrlWithExtension);  
     
            //                break;  
            //            }  
            //        }  
            //    }  
            //    else  
            //    {  
            //        if (Session["sessIContentGuid"] != null)  
            //        {  
            //            selectedPostGuid = new Guid(Session["sessIContentGuid"].ToString());  
     
            //            foreach (IContent post in allposts)  
            //            {  
            //                if (post.ID == selectedPostGuid)  
            //                {  
            //                    hplComment.NavigateUrl = string.Format("~/BlogComment/{0}", post.UrlWithExtension);  
            //                    GetReporterInfo((string)post.GetMetaData("Reporter"));  
            //                    break;  
            //                }  
            //            }  
            //        }  
            //    }  
            //}  
            #endregion  
     
            Telerik.Blogs.BlogManager manager = new Telerik.Blogs.BlogManager("Blogs");  
            IList listOfAllBlogs = manager.GetBlogs();  
            Guid selectedPostGuid = new Guid();  
            string commentCount = "";  
     
            foreach (IBlog blogItem in listOfAllBlogs)  
            {  
                Guid parentId = blogItem.ID;  
                IList allposts = manager.GetPosts(string.Empty, parentId, parentId);  
     
                if (Common.QueryString("searchid").Length > 0)  
                {  
                    selectedPostGuid = new Guid(Common.QueryString("searchid"));  
     
                    foreach (IContent post in allposts)  
                    {  
                        if (post.ID == selectedPostGuid)  
                        {  
                            if (!string.IsNullOrEmpty((string)post.GetMetaData("Reporter")))  
                            {  
                                GetReporterInfo((string)post.GetMetaData("Reporter"));  
                                break;  
                            }  
                            else  
                                sfReporterPhoto.Visible = false;  
                        }  
                    }  
                }  
                else  
                {  
                    if (Session["sessIContentGuid"] != null)  
                    {  
                        selectedPostGuid = new Guid(Session["sessIContentGuid"].ToString());  
     
                        foreach (IContent post in allposts)  
                        {  
                            if (post.ID == selectedPostGuid)  
                            {  
                                if (!string.IsNullOrEmpty((string)post.GetMetaData("Reporter")))  
                                {  
                                    GetReporterInfo((string)post.GetMetaData("Reporter"));  
                                    break;  
                                }  
                                else  
                                    sfReporterPhoto.Visible = false;  
                            }  
                        }  
                    }  
                }  
            }  
        }  
        #endregion  
     
        #region[Reporter Info]  
        private void GetReporterInfo(string contentID)  
        {  
            if (contentID.Length > 0)  
            {  
                Guid contentGuid = new Guid(contentID);  
     
                // create new instance of ContentManager  
                Telerik.Cms.Engine.ContentManager contentManager = new Telerik.Cms.Engine.ContentManager();  
     
                // get all content items  
                IList listOfContentItems = contentManager.GetContent();  
                if (listOfContentItems.Count > 0)  
                {  
                    foreach (IContent iContent in listOfContentItems)  
                    {  
                        if (iContent.ID == contentGuid)  
                        {  
                            string reporterPhoto = (string)iContent.GetMetaData("ReporterPhoto");  
                            lAuthorName.Text = (string)iContent.GetMetaData("Name");  
                            lAuthorName2.Text = (string)iContent.GetMetaData("Name");  
                            hpAuthorBioURL.NavigateUrl = string.Format("~/Reporters.aspx?rpt={0}",iContent.ID.ToString());  
                            hpAuthorBioURL.Text = "READ BIOGRAPHY";  
                            ReporterCaption.Text = (string)iContent.GetMetaData("ReporterCaption");  
                            ReporterCaption2.Text = (string)iContent.GetMetaData("ReporterCaption");  
     
                            if (reporterPhoto.Length > 0)  
                                sfReporterPhoto.ImageUrl = string.Format("{0}", reporterPhoto);  
                            else  
                                sfReporterPhoto.Visible = false;  
     
                            break;  
     
                               
     
                        }  
                    }  
                }  
            }  
        }  
        #endregion  
     
        public Guid[] SelectedBlogs  
        {  
            get  
            {  
                return this.selectedBlogs;  
            }  
            set  
            {  
                this.selectedBlogs = value;  
            }  
        }    
     
     
          
    }  
     

    ContentViewSingleItemPrint.ascx

    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="ContentViewSingleItemPrint.ascx.cs" Inherits="Sitefinity_ControlTemplates_Blogs_ContentViewSingleItemPrint" %> 
    <%@ Register Assembly="Telerik.Cms.Engine" Namespace="Telerik.Cms.Engine.WebControls" TagPrefix="sfWeb" %> 
    <%@ Register Assembly="Telerik.Cms.Web.UI" Namespace="Telerik.Web.UI.SpamProtection" TagPrefix="sfWeb" %> 
    <%@ Register Assembly="Telerik.Cms.Web.UI" Namespace="Telerik.Cms.Web.UI" TagPrefix="sfWeb" %> 
    <%@ Register Assembly="Telerik.Blogs" Namespace="Telerik.Blogs.WebControls" TagPrefix="sfWeb" %> 
    <%@ Register TagPrefix="sf" Assembly="Telerik.Cms.Engine" Namespace="Telerik.Cms.Engine.WebControls" %> 
    <%@ Register TagPrefix="TN" TagName="ucPostAnonomously" Src="~/Sitefinity/ControlTemplates/Blogs/ucPostAnonomously.ascx" %> 
    <%@ Register TagPrefix="TN" TagName="ucSendFriend" Src="~/Sitefinity/ControlTemplates/Blogs/ucSendFriend.ascx" %> 
     
    <telerik:CssFileLink ID="CssFileLink1" EmbeddedFileName="Telerik.Blogs.Resources.ControlTemplates.Frontend.blogsCommonLayout.css" FileName="" Media="screen" runat="server" /> 
    <telerik:JsFileLink id="jsLink" runat="server" ScriptType="jQuery" />   
     
     
    <asp:PlaceHolder ID="trackbackScript" runat="server">  
     
    </asp:PlaceHolder> 
     
    <div class="sf_singlePost">  
    <asp:Label ID="AuthorPhoto" runat="server" Visible="false"></asp:Label> 
        <asp:Label ID="AuthorName" runat="server" Visible="false"></asp:Label> 
        <asp:Label ID="AuthorBioURL" runat="server" Visible="false"></asp:Label> 
       <asp:HyperLink id="hyperlink1"   
                      NavigateUrl="http://www.microsoft.com" 
                      Text="Microsoft Official Site" 
                      Target="_new" 
                      runat="server"/>      
       </asp:hyperlink> 
     
        <%--<class="sf_back">  
           <asp:HyperLink ID="backToList1" Text="<%$Resources:GoBack %>" runat="server"></asp:HyperLink>   
        </p>--%> 
     
       <h1 class="sf_postTitle">  
            <asp:Literal ID="Title" runat="server"></asp:Literal> 
        </h1> 
         <!-- post author :begin--> 
        <div class="post-author">  
            <span class="a-img-bg"><sfWeb:SitefinityImage  ID="sfReporterPhoto" runat="server" Width="176px" Height="199px"  /></span><span class="a-name"><asp:Literal ID="lAuthorName" runat="server"></asp:Literal></span>  
            <class="a-desc"><asp:Literal ID="ReporterCaption" runat="server"></asp:Literal></p>  
            <asp:HyperLink ID="hpAuthorBioURL" runat="server" ></asp:HyperLink> 
         </div> 
        <!-- post author :end--> 
          
       <class="sf_postAuthor">  
            <%--<asp:Literal ID="Literal3" runat="server" Text="<%$Resources:Author %>"></asp:Literal> 
            <asp:HyperLink ID="postedBy" runat="server">  
                <asp:Literal ID="Author" runat="server"></asp:Literal> 
            </asp:HyperLink>--%> 
            Written By: <asp:Literal ID="lAuthorName2" runat="server"></asp:Literal> 
        </p> 
       <class="sf_postAuthor">  
                &nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
                <asp:Literal ID="ReporterCaption2" runat="server"></asp:Literal> 
        </p> 
        <class="sf_postDate">  
            <telerik:DateTimeLiteral runat="server" ID="Publication_Date" DateFormatString="D"></telerik:DateTimeLiteral> 
        </p> 
        <asp:Panel ID="pnlContent" runat="server" CssClass="sf_postContent">  
            <asp:Literal ID="content" runat="server"></asp:Literal> 
        </asp:Panel> 
         <%--<class="sf_postCategory">  
            <asp:Literal ID="CategoryLiteral" runat="server" Text="<%$Resources:Category %>" /><asp:HyperLink ID="Category" runat="server" /> 
         </p>--%> 
         <class="sf_postTags">  
              
            <asp:Repeater ID="Tags" runat="server">  
                <HeaderTemplate> 
                    <asp:Literal ID="TagsLiteral" runat="server" Text="<%$Resources:Tags %>" /> 
                </HeaderTemplate> 
                <ItemTemplate> 
                    <asp:HyperLink ID="tagLink" runat="server" /> 
                </ItemTemplate> 
            </asp:Repeater> 
        </p> 
          
        <asp:Repeater ID="Bookmarks" runat="server">  
            <HeaderTemplate><ul class="sf_socialBookmarks"></HeaderTemplate> 
            <ItemTemplate> 
                <li> 
                    <asp:HyperLink ID="BookmarkLink" runat="server">  
                        <asp:Image ID="BookmarkImage" runat="server" /> 
                    </asp:HyperLink> 
                </li> 
            </ItemTemplate>    
            <FooterTemplate></ul></FooterTemplate> 
        </asp:Repeater>    
          
    </div> 
     
     
    <div class="">  
        <sfWeb:BlogCommentsList ID="commentsList" runat="server" CssClass="sf_commentsList" ValidationGroup="commentInfo">  
                  <LayoutTemplate> 
            <asp:Repeater ID="commentsRepeater" runat="Server" > 
              
        <HeaderTemplate> 
            <asp:PlaceHolder runat="server" ID="headerHolder" Visible="true">  
                <h2 class="sf_comments" style="padding-left:15px;">  
                    <asp:Literal ID="Literal1" runat="server" Text="<%$Resources:Comments %>" /> 
                    (<asp:Literal ID="commentsCount" runat="server"></asp:Literal>)  
                </h2>   
            </asp:PlaceHolder>        
            <div class="sf_dbComment">  
            <ul class="sf_commentListing">  
        </HeaderTemplate> 
        <ItemTemplate>   
            <!-- comment goes here --> 
            <sfWeb:CommentItem Id="anonCommentContainer" runat="server" CssClass="sf_anonymousComment" >   
              
             <Template> 
                  
                    <div class="sfComment1Top"></div> 
                    <div class="sfComment1Body">  
                        <asp:Label ID="text" runat="server"></asp:Label> 
                    </div> 
                    <div class="sfComment1Bot"></div>             
                 
                   <class="sf_commentAuthor" style="padding-left:20px;">  
                        <strong style="color:#d81b1a">  
                            <asp:HyperLink ID="webSiteLink" runat="server" Visible="false" rel="nofollow"></asp:HyperLink> 
                            <asp:Literal runat="Server" ID="authorName"  Visible="false"></asp:Literal>   
                        </strong> 
                        <%--<abbr class="date" id="commentDate" runat="server" > </abbr>--%> 
                        <telerik:DateTimeLiteral ID="commentDateLiteral" runat="server" DateFormatString="f" /> 
                    </p> 
                  
            </Template> 
             
            </sfWeb:CommentItem> 
             
            <sfWeb:CommentItem Id="authorCommentContainer" runat="server"  CssClass="">   
             <Template> 
                <div class="sfComment2Top"></div> 
                <div class="sfComment2Body">  
                    <asp:Label ID="text" runat="server"></asp:Label> 
                </div> 
                <div class="sfComment2Bot"></div> 
                      
                 <class="sf_commentAuthor" style="padding-left:20px;">  
                    <strong style="color:#d81b1a">  
                        <asp:HyperLink ID="webSiteLink" runat="server" Visible="false" rel="nofollow"></asp:HyperLink> 
                        <asp:Literal runat="Server" ID="authorName"  Visible="false" ></asp:Literal>   
                    </strong> 
                    <%--<abbr class="date" id="commentDate" runat="server"</abbr>--%> 
                    <telerik:DateTimeLiteral ID="commentDateLiteral" runat="server" DateFormatString="f" /> 
                </p> 
                  
             </Template> 
              
           </sfWeb:CommentItem> 
              
        </ItemTemplate> 
        <FooterTemplate> 
            </ul> 
            </div> 
        </FooterTemplate> 
    </asp:Repeater> 
    <asp:PlaceHolder ID="moderationHolder" runat="server" Visible="false">  
        <class="sf_commentMessage">  
            <asp:Literal ID="Literal2" runat="server" Text="<%$Resources:CommentMessageModeration %>"></asp:Literal> 
        </p> 
    </asp:PlaceHolder> 
     
        <div class="sf_PostCommentHeader"></div> 
        <fieldset class="sf_postNewComment">  
              
            <ol> 
                <li> 
                    <asp:Label ID="Label2" runat="Server" Text="<%$Resources:Name %>" AssociatedControlID="authorTxt"></asp:Label> 
                    <asp:TextBox ID="authorTxt" runat="server" size="30"></asp:TextBox> 
                    <asp:RequiredFieldValidator runat="server" ID="authorVal" ControlToValidate="authorTxt" 
                            ErrorMessage="<%$Resources:NameEmpty %>" Display="dynamic"   
                            CssClass="sf_commentsValidator"></asp:RequiredFieldValidator> 
     
                </li> 
                <li> 
                    <asp:Label ID="Label3" runat="Server" Text="<%$Resources:Email %>" AssociatedControlID="emailTxt"></asp:Label> 
                    <asp:TextBox ID="emailTxt" runat="server" size="30"></asp:TextBox> 
                    <asp:RegularExpressionValidator runat="server" ID="emailVal" ControlToValidate="emailTxt" 
                            ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" ErrorMessage="<%$Resources:InvalidEmail %>" 
                            Display="dynamic" CssClass="sf_commentsValidator"></asp:RegularExpressionValidator> 
                </li> 
                <li> 
                    <asp:Label ID="Label4" runat="Server" Text="<%$Resources:WebSite %>" AssociatedControlID="webSiteTxt"></asp:Label> 
                    <asp:TextBox ID="webSiteTxt" runat="server" size="30"></asp:TextBox>   
                </li> 
                <li class="texarea-wrapper">  
                    <asp:Label ID="Label1" runat="Server" Text="<%$Resources:Comment %>" AssociatedControlID="commentTxt"></asp:Label> 
                    <div> 
                        <href="#" class="formattingOptionsToggleBtn" onclick='if($(this).parent().hasClass("formattingOptions")){$(this).parent().removeClass("formattingOptions");$(this).text("Formatting options");}else{$(this).parent().addClass("formattingOptions");$(this).text("Hide formatting options"); } return false;'>Formatting options</a> 
                         <telerik:RadEditor   
                                runat="server"   
                                ID="commentTxt" 
                                ToolsFile="~/Sitefinity/ControlTemplates/Blogs/ToolsFile.xml" 
                                EnableEmbeddedSkins="True"   
                                Skin="Default"   
                                Width="99%" 
                                Height="200px"   
                                EditModes="Design">              
                         </telerik:RadEditor>     
                    </div>    
                     <asp:RequiredFieldValidator runat="server" ID="contentVal"   
                            ControlToValidate="commentTxt" 
                            ErrorMessage="<%$Resources:CommentEmpty %>"   
                            Display="dynamic"   
                            ValidationGroup="commentInfo" 
                            CssClass="sf_commentsValidator">  
                            <strong>Message text is required</strong> 
                     </asp:RequiredFieldValidator>                                                                                                                      
                </li>             
                <li> 
                <sfWeb:SpamProtector id="spamProtector" runat="server" cssclass="commentsValidator hide" 
                    enableautobotdiscovery="true" enablehiddentextboxstrategy="true" 
                    hiddentextboxerrormessage="Hidden TextBox has some text in it!" hiddentextboxlabel="Do not fill this textbox!" 
                    hiddentextboxlabelcssclass="hide" hiddentextboxinputcssclass="hide" enablemintimeoutstrategy="true" 
                    mintimeout="2" mintimeouterrormessage="Submission too fast!" /> 
                <asp:Button ID="submitBtn" runat="server" Text="" 
                    CssClass="sf_commentSubmit" /> 
                </li> 
            </ol> 
        </fieldset> 
     
            </LayoutTemplate> 
        </sfWeb:BlogCommentsList> 
    </div> 
    <br /> 
     
    <div class="sf_dbComment">      
        <TN:ucPostAnonomously id="ucPostAnonomously1" runat="server" /> 
        <TN:ucSendFriend id="ucSendFriend1" runat="server" /> 
    </div> 
     
    <div class="sf_dbComment" visible="false" runat="server">  
        <asp:HyperLink cssclass="post-a-comment" ID="hplComment" runat="server"></asp:HyperLink>     
    </div> 
     


    ContentViewSingleItemPrint.ascx.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.News.WebControls;  
    using Telerik.Cms.Web;  
    using Telerik.Cms.Engine;  
    using Telerik.Cms.Engine.ContentViewFiltering;  
    using System.Collections;  
    using Telerik.Blogs;  
    using DeepBlueCore;  
     
     
    public partial class Sitefinity_ControlTemplates_Blogs_ContentViewSingleItem : System.Web.UI.UserControl  
    {  
    protected void Page_Load(object sender, EventArgs e)  
       {  
           Guid itemID = (Guid)Session["PostID"];  
           var manager = ContentManager("Blogs");  
           IContent cnt = manager.GetContent(itemID);  
       }  
     
        #region[old]  
        Telerik.Blogs.BlogManager manager = new Telerik.Blogs.BlogManager("Blogs");  
        IList listOfAllBlogs = manager.GetBlogs();  
        Guid selectedPostGuid = new Guid();  
        string commentCount = "";  
     
        foreach (IBlog blogItem in listOfAllBlogs)  
        {  
            Guid parentId = blogItem.ID;  
            IList allposts = manager.GetPosts(string.Empty, parentId, parentId);  
     
            if (Common.QueryString("sessionid").Length > 0)  
            {  
                selectedPostGuid = new Guid(Common.QueryString("sessionid"));  
     
                foreach (IContent post in allposts)  
                {  
                    if (post.ID == selectedPostGuid)  
                    {  
                        hplComment.NavigateUrl = string.Format("~/BlogComment/{0}", post.UrlWithExtension);  
     
                        break;  
                    }  
                }  
            }  
            else  
            {  
                if (Session["sessIContentGuid"] != null)  
                {  
                    selectedPostGuid = new Guid(Session["sessIContentGuid"].ToString());  
     
                    foreach (IContent post in allposts)  
                    {  
                        if (post.ID == selectedPostGuid)  
                        {  
                            hplComment.NavigateUrl = string.Format("~/BlogComment/{0}", post.UrlWithExtension);  
                            GetReporterInfo((string)post.GetMetaData("Reporter"));  
                            break;  
                        }  
                    }  
                }  
            }  
        }  
        #endregion  
         
     
     
    }  
     


  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    25 Jan 2010
    Link to this post
    Hello Steven Lancaster,

    In your code you are setting the Literal ID as PostID in the Session instead of the post ID.

    <asp:Literal ID="content" runat="server"></asp:Literal>


    Kind regards,
    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.
  7. Steven Lancaster
    Steven Lancaster avatar
    82 posts
    Registered:
    06 Nov 2009
    28 Jan 2010
    Link to this post

    Sorry to be such a pain just clarifying some things.

    This Current:

    protected void Page_Load(object sender, EventArgs e)     
       {     
           Guid itemID = (Guid)Session["PostID"];     
           var manager = ContentManager("Blogs");     
           IContent cnt = manager.GetContent(itemID);     
       }     
     

    This is what it should be?
    protected void Page_Load(object sender, EventArgs e)     
       {     
           Guid itemID = (Guid)Session["Post.ID"];     
           var manager = ContentManager("Blogs");     
           IContent cnt = manager.GetContent(itemID);     
       }     
     
  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    28 Jan 2010
    Link to this post
    Hi Steven Lancaster,

    Please take a look at this article that explains how Session State works -ASP.NET Session State Overview.

    Greetings,
    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.
  9. Steven Lancaster
    Steven Lancaster avatar
    82 posts
    Registered:
    06 Nov 2009
    28 Jan 2010
    Link to this post
    I am sorry for this I have read the article and I can not see where I have made a mistake.

    I am killing myself trying to fix this.

    -Steve
  10. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    29 Jan 2010
    Link to this post
    Hi Steven Lancaster,

    You have to use the session which is the ID of a content item to get this item on another page

    Guid itemID = (Guid)Session["PostID"];    
    var manager = ContentManager("Blogs");    
    IContent cnt = manager.GetContent(itemID);

    On the previous page you need to set the Session to the id of the content object that you should get. The content object has ID property that you have to use.

    Greetings,
    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.
Register for webinar
10 posts, 0 answered