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

Forums / General Discussions / Display Poll on Full Story Blog Post Page

Display Poll on Full Story Blog Post Page

10 posts, 1 answered
  1. Darren du Preez
    Darren du Preez avatar
    6 posts
    Registered:
    18 Feb 2010
    29 Sep 2010
    Link to this post
    Hi, I have website that will have various blog pages. These page display a list of posts for these blogs. When a visitor then proceeds to view the full story of a particular post, I want to have a particular poll displayed. How do I go about doing this?
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    29 Sep 2010
    Link to this post
    Hi Darren,

    You have to add PollBox control inside ListPageDetail template of BlogPost control. The you should get the post ID from the QueryString and set PollID depending on the IContent item you see

    if (Context.Items.Contains(Manager.Provider.ContentItemKey))
    itemId = (Guid)((IUrlRewriteData)Context.Items[Manager.Provider.ContentItemKey]).Data;


    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. Darren du Preez
    Darren du Preez avatar
    6 posts
    Registered:
    18 Feb 2010
    04 Oct 2010
    Link to this post
    Hi Ivan

    Thank you for the feedback. I apologise for the late reply. Will it be possible for you to provide an example?

    Regards,
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    04 Oct 2010
    Link to this post
    Hi Darren,

    Here is a sample code that illustrates how to modify the template and set the poll ID depending on the current IContent item

    <%@ Control Language="C#" %>
    <%@ 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.Blogs" Namespace="Telerik.Blogs.WebControls" TagPrefix="sfWeb" %>
    <%@ Register Assembly="Telerik.Polls" Namespace="Telerik.Polls.WebControls" TagPrefix="sfPolls" %>
     
    <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 type="text/C#" runat="server">
         
        public void Page_Load(object sender, EventArgs e)
        {
            var Manager = new Telerik.Cms.Engine.ContentManager("Blogs");
            if (Context.Items.Contains(Manager.Provider.ContentItemKey))
            {
                var itemId = (Guid)((Telerik.Web.IUrlRewriteData)Context.Items[Manager.Provider.ContentItemKey]).Data;
                if (itemId != null && itemId != Guid.Empty)
                {
                    // here you should set the id of the poll you want to display. It could be
                    // a metakey that is linked to the content item, so you can call GetMetaData method of the IConent item
                    // that you have accessed
                    var _pollID = Guid.Empty;
                    this.PollBox1.PollId = _pollID;
                }
            }
        }
     
    </script>
     
    <asp:PlaceHolder ID="trackbackScript" runat="server">
     
    </asp:PlaceHolder>
     
    <div class="sf_singlePost">
        <p 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>
       <p class="sf_postAuthor">
            <asp:HyperLink ID="postedBy" runat="server">
                <asp:Literal ID="Author" runat="server"></asp:Literal>
            </asp:HyperLink>
        </p>
        <p class="sf_postDate">
            <asp:Literal ID="Publication_Date" runat="server" Text="{0}" />
        </p>
        <asp:Panel ID="pnlContent" runat="server" CssClass="sf_postContent">
            <asp:Literal ID="content" runat="server"></asp:Literal>
        </asp:Panel>
         <p class="sf_postCategory">
            <asp:HyperLink ID="Category" runat="server" />
         </p>
         <p class="sf_postTags">
            <asp:Repeater ID="Tags" runat="server">
                <ItemTemplate>
                    <asp:HyperLink ID="tagLink" runat="server" />
                </ItemTemplate>
            </asp:Repeater>
        </p>
        <p class="sf_postBookmark">
          <asp:Repeater ID="Bookmarks" runat="server">
              <ItemTemplate>
                    <asp:HyperLink ID="BookmarkLink" runat="server">
                        <asp:Image ID="BookmarkImage" runat="server" />
                    </asp:HyperLink>
              </ItemTemplate
          </asp:Repeater
        </p>
    </div>
     
    <div class="sf_postComments" runat="server" id="postCommentsPlh">
        <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">
                <h2 class="sf_comments">
                    <asp:Literal ID="Literal1" runat="server" Text="<%$Resources:Comments %>" />
                     <asp:Literal ID="commentsCount" runat="server"></asp:Literal>
                </h2>
            </asp:PlaceHolder>
            <ul class="sf_commentListing">
        </HeaderTemplate>
        <ItemTemplate>
            <!-- comment goes here -->
            <sfWeb:CommentItem Id="anonCommentContainer" runat="server" CssClass="sf_anonymousComment" >
             
             <Template>
               <p class="sf_commentAuthor">
                    <strong>
                        <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="sf_commentDate" id="commentDate" runat="server" > </abbr>--%>
                    <telerik:DateTimeLiteral ID="commentDateLiteral" runat="server" DateFormatString="" />
                </p>
                <asp:Label ID="text" runat="server"></asp:Label>
            </Template>
            
            </sfWeb:CommentItem>
            
            <sfWeb:CommentItem Id="authorCommentContainer" runat="server"  CssClass="sf_authorComment">
             <Template>
                 <p class="sf_commentAuthor">
                    <strong>
                        <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="sf_commentDate" id="commentDate" runat="server"> </abbr>--%>
                    <telerik:DateTimeLiteral ID="commentDateLiteral" runat="server" DateFormatString="" />
                </p>
                <asp:Label ID="text" runat="server"></asp:Label>
             </Template>
             
           </sfWeb:CommentItem>
             
        </ItemTemplate>
        <FooterTemplate>
            </ul>
        </FooterTemplate>
    </asp:Repeater>
    <asp:PlaceHolder ID="moderationHolder" runat="server" Visible="false">
        <p class="sf_commentMessage">
            <asp:Literal ID="Literal2" runat="server" Text="<%$Resources:CommentMessageModeration %>"></asp:Literal>
        </p>
    </asp:PlaceHolder>
     
        <fieldset class="sf_postNewComment">
            <legend>Post a comment!</legend>
            <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>
                        <a 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="100%"
                                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="<%$Resources:PostThisComment %>"
                    CssClass="sf_commentSubmit" />
                </li>
            </ol>
        </fieldset>
     
            </LayoutTemplate>
        </sfWeb:BlogCommentsList>
         
        <sfPolls:PollBox runat="server" ID="PollBox1" ></sfPolls:PollBox>
    </div>



    Greetings,
    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
    Answered
  5. Darren du Preez
    Darren du Preez avatar
    6 posts
    Registered:
    18 Feb 2010
    06 Oct 2010
    Link to this post
    Hi Ivan

    Thank you  for  your assistance with this, it is much appreciated.

    Regards,
  6. Rosco
    Rosco avatar
    13 posts
    Registered:
    30 Oct 2008
    13 Oct 2010
    Link to this post
    Hi there,

    What do I need to do to use the <sfWeb:BlogCommentsList> control? it does not sure up in intellisense.
  7. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    13 Oct 2010
    Link to this post
    Hi Rosco,

    You have to register the tag prefix inside the template or in your web.config.

    <%@ Register Assembly="Telerik.Blogs" Namespace="Telerik.Blogs.WebControls" TagPrefix="sfWeb" %>

    Then the BlogCommentsList will be available in the intellisence.


    All the best,
    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
  8. Rosco
    Rosco avatar
    13 posts
    Registered:
    30 Oct 2008
    13 Oct 2010
    Link to this post
    Yes I have already added the following: 

     


    <%@ 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" %> 


    However, only BlogEditor, BloggersList, and BlogSelector are available in intellisense.
  9. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    13 Oct 2010
    Link to this post
    Hello Rosco,

    NameSpace: Telerik.Blogs.WebControls
    Assembly: Telerik.Blogs

    If you do not see BlogCommentsList, then you are using an older version of Sitefinity.

    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
  10. Rosco
    Rosco avatar
    13 posts
    Registered:
    30 Oct 2008
    13 Oct 2010
    Link to this post
    Hi Ivan,

    Thanks for the quick reply. I think we do have a supported version of SiteFinity, because we are currently using blogs on our website http://www.magnetism.co.nz. I see a control called ContentViewSingleItem.ascx which uses the <sfWeb:BlogCommentsList> control, and I have tried to do the same on my custom control. Could I be missing a step somewhere?
Register for webinar
10 posts, 1 answered