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

Forums / Developing with Sitefinity / Creat a 'This is not okay' button

Creat a 'This is not okay' button

16 posts, 0 answered
  1. Daniel Plomp
    Daniel Plomp avatar
    112 posts
    Registered:
    14 Jun 2012
    08 Oct 2010
    Link to this post
    Hi,

    I'd like to create a 'This is not okay' button / link inside the comments section of a blog.
    So users should have the ability to click a link that sends an email to the webmaster that 1 or more comments are not okay.

    How can I adjust the blogs module to do this?

    Thanks,
    Daniel
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    08 Oct 2010
    Link to this post
    Hi Daniel,

    You could map CommentsList.ascx external template and subscribe for CommentsGrid_RowCreated. Get the comment ID ((GridView)sender).DataKeys[e.Row.RowIndex].Value); and send an email by using SmtpClient class.

    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
  3. Daniel Plomp
    Daniel Plomp avatar
    112 posts
    Registered:
    14 Jun 2012
    08 Oct 2010
    Link to this post
    Hi Ivan,

    I've adjust the comments inside the ContentSingleView.ascx. Is it possible from there?

    Regards,
    Daniel
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    08 Oct 2010
    Link to this post
    Hello Daniel Plomp,

    It is possible but this is the public control. You need to inherit from CommentsList and get the comment item inside ItemDataBound control of CommentsRepeater. You can subscribe for the event inside InitializeCotnrols of CommentsList

    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
  5. Daniel Plomp
    Daniel Plomp avatar
    112 posts
    Registered:
    14 Jun 2012
    08 Oct 2010
    Link to this post
    Hello Ivan,

    Thanks for your reply.
    Is it possible to give me an example of this?

    My BlogList control is already a custom control (inheriting from BlogPosts).
    It isn't possible to address the CommentsRepeater from there?

    Because on the public site, the CommentsList and the BlogPost detail are in one control.

    Regards,
    Daniel
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    08 Oct 2010
    Link to this post
    Hello Daniel,

    CommentsList is a custom control which is declared inside ListPageDetails.ascx template of the BlogPosts control. Actually the control we use is BlogCommentsList and it inherits from CommentsList which is the base class. So you have to inherit from BlogCommentsList and replace the default control declared inside ListPageDetails template used by BlogPosts.

    Sincerely yours,
    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
  7. Daniel Plomp
    Daniel Plomp avatar
    112 posts
    Registered:
    14 Jun 2012
    11 Oct 2010
    Link to this post
    Hi Ivan,

    Thanks for the reply.
    I've created this class:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using Telerik.Blogs.WebControls;
      
    /// <summary>
    /// Summary description for CustomBlogCommentsList
    /// </summary>
    public class CustomBlogCommentsList : BlogCommentsList
    {
       public CustomBlogCommentsList()
       {
              
       }
    }

    Could you please help me getting started? I don't know exactly which methods or 'overrides' I should use.
    I adjusted the template so that there is a <asp:Hyperlink> that should do the trick.

    An example would be very nice!

    Thanks anyway,
    Daniel
  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    11 Oct 2010
    Link to this post
    Hello Daniel,

    You could take a look at change blog post comments

    Sincerely yours,
    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
  9. Daniel Plomp
    Daniel Plomp avatar
    112 posts
    Registered:
    14 Jun 2012
    11 Oct 2010
    Link to this post
    Hi Ivan,

    I'm not sure if I'm understanding it. I adjusted the 'Comments' section inside the 'ContentViewSingleItem.ascx' template. I don't use a seperate template for the 'CommentsList'. I don't think I have to set the Template path, right?

    I tried to declare a page directive, so that I can debug, to see if my custom class works.

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

    Then I'm getting an error:
    Parser Error Message: Unknown server tag 'sfWebExt:BlogCommentsList'.

    The code inside of the template:
    <sfWebExt:BlogCommentsList ID="commentsList" runat="server" CssClass="sf_commentsList"
        ValidationGroup="commentInfo">

    The custom class is in this location:
    \App_Code\Modules\Blogs\CustomBlogCommentsList.cs

    What am I doing wrong?

    Daniel
  10. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    11 Oct 2010
    Link to this post
    Hi Daniel,

    1. LayoutTemplatePath should be set in the class that inherits from BlogCommentsList

    2. You are getting parse error, because the namespace of your class is not correct and there is no class called BlogCommentsList inside assembly App_Code with namepsace Telerik.Blogs.WebControls

    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
  11. Daniel Plomp
    Daniel Plomp avatar
    112 posts
    Registered:
    14 Jun 2012
    11 Oct 2010
    Link to this post
    Hi Ivan,

    I don't get it with this TemplatePath. I use the repeater inside 'ContentViewSingleItem.ascx'. So I don't have to point to a seperate CommentsList template, right?

    Regarding the other issue: this is the code of my custom class. The event doesn't seem to fire...

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using Telerik.Blogs.WebControls;
    using System.Web.UI.WebControls;
      
    namespace Telerik.Blogs.WebControls
    {
        /// <summary>
        /// Summary description for CustomBlogCommentsList
        /// </summary>
        public class CustomBlogCommentsList : BlogCommentsList
        {
            public CustomBlogCommentsList()
            {
      
            }
      
            /// <summary>
            /// Initialize controls
            /// </summary>
            /// <param name="controlContainer"></param>
            protected override void InitializeControls(System.Web.UI.Control controlContainer)
            {
                base.InitializeControls(controlContainer);
      
                this.CommentsRepeater.ItemDataBound += new System.Web.UI.WebControls.RepeaterItemEventHandler(CommentsRepeater_ItemDataBoundCustom);
      
            }
      
            void CommentsRepeater_ItemDataBoundCustom(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e)
            {
                if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
                {
                    HyperLink lnkNotOke = e.Item.FindControl("lnkNotOk") as HyperLink;
                    lnkNotOke.Text = "it bounds!";
                }
            }
        }
    }

    This is the code of my 'ContentViewSingleItem.ascx':




    <%@ 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.Cms.Web.UI" Namespace="Telerik.Cms.Web.UI" TagPrefix="sfWeb" %>
    <%@ Register Assembly="Telerik.Blogs" Namespace="Telerik.Blogs.WebControls" TagPrefix="sfWeb" %>
    <%@ Register Assembly="App_Code" Namespace="Telerik.Blogs.WebControls" TagPrefix="sfWeb" %>
    <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="image-holder">
        <asp:Image runat="server" ImageUrl="~/Assets/Img/img07.jpg" />
    </div>
    <div class="post-content">
        <h1>
            <asp:Literal ID="Title" runat="server"></asp:Literal></h1>
        <div class="meta">
            <p>
                Geplaatst op:
                <telerik:DateTimeLiteral runat="server" ID="Publication_Date" DateFormatString="D">
                </telerik:DateTimeLiteral>
                 |  Door:
                <asp:Literal ID="Author" runat="server"></asp:Literal></p>
        </div>
        <asp:Literal ID="content" runat="server"></asp:Literal>
    </div>
    Voeg toe aan:
    <div class="socials">
        <asp:Repeater ID="Bookmarks" runat="server">
            <HeaderTemplate>
                <ul>
            </HeaderTemplate>
            <ItemTemplate>
                <li>
                    <asp:HyperLink ID="BookmarkLink" Target="_blank" runat="server">
                        <asp:Image ID="BookmarkImage" runat="server" />
                    </asp:HyperLink>
                </li>
            </ItemTemplate>
            <FooterTemplate>
                </ul></FooterTemplate>
        </asp:Repeater>
    </div>
    <div class="clearer">
    </div>
    <sfWeb:CustomBlogCommentsList ID="commentsList" runat="server" CssClass="sf_commentsList"
        ValidationGroup="commentInfo">
        <LayoutTemplate>
            <asp:Repeater ID="commentsRepeater" runat="Server">
                <HeaderTemplate>
                    <asp:PlaceHolder runat="server" ID="headerHolder">
                        <h2>
                            <asp:Literal ID="Literal1" runat="server" Text="<%$Resources:Comments %>" />
                             (<asp:Literal ID="commentsCount" runat="server"></asp:Literal>)
                        </h2>
                    </asp:PlaceHolder>
                    <ul class="posts">
                </HeaderTemplate>
                <ItemTemplate>
                    <!-- comment goes here -->
                    <sfWeb:CommentItem ID="anonCommentContainer" runat="server">
                        <Template>
                            <div class="holder">
                                <div class="photo">
                                    <div class="place">
                                        <a href="#">
                                            <asp:Image ID="imgUser" runat="server" ImageUrl="~/Assets/Img/img08.jpg" Width="52"
                                                Height="76" />
                                        </a>
                                    </div>
                                    <span>
                                        <asp:Literal runat="Server" ID="authorName" Visible="false"></asp:Literal></span>
                                    <em>
                                        <telerik:DateTimeLiteral ID="commentDateLiteral" runat="server" DateFormatString="dd MMM yyy" />
                                    </em>
                                </div>
                                <div class="text">
                                    <asp:Label ID="text" runat="server"></asp:Label>
                                    <div class="author">
                                        <asp:HyperLink ID="lnkNotOk" runat="server">Dit is niet oké</asp:HyperLink>
                                        <!-- <a href="#">Dit is niet oké</a> -->
                                    </div>
                                </div>
                            </div>
                        </Template>
                    </sfWeb:CommentItem>
                    <sfWeb:CommentItem ID="authorCommentContainer" runat="server" CssClass="sf_authorComment">
                        <Template>
                            <div class="holder">
                                <div class="photo">
                                    <div class="place">
                                        <a href="#">
                                            <asp:Image ID="imgUser" runat="server" ImageUrl="~/Assets/Img/img08.jpg" Width="52"
                                                Height="76" /></a>
                                    </div>
                                    <span>
                                        <asp:Literal runat="Server" ID="authorName" Visible="false"></asp:Literal></span>
                                    <em>
                                        <telerik:DateTimeLiteral ID="commentDateLiteral" runat="server" DateFormatString="dd MMM yyy" />
                                    </em>
                                </div>
                                <div class="text">
                                    <asp:Label ID="text" runat="server"></asp:Label>
                                    <div class="author">
                                        <asp:HyperLink ID="lnkNotOk" runat="server">Dit is niet oké</asp:HyperLink>
                                        <!-- <a href="#">Dit is niet oké</a> -->
                                    </div>
                                </div>
                            </div>
                        </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>
            <h2>
                Plaats een reactie</h2>
            <div class="edit-box">
                <div class="holder">
                    <div class="photo">
                        <div class="place">
                            <asp:Image ID="imgUser" runat="server" ImageUrl="~/Assets/Img/img10.jpg" />
                        </div>
                        <span>Anoniem</span> <em>15 sept, 14:30 uur</em>
                    </div>
                    <div class="textinsert">
                        <asp:Label ID="Label2" runat="Server" Text="<%$Resources:Name %>" AssociatedControlID="authorTxt"></asp:Label><br />
                        <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>
                    </div>
                    <div class="textinsert">
                        <asp:Label ID="Label4" runat="Server" Text="<%$Resources:WebSite %>" AssociatedControlID="webSiteTxt"></asp:Label><br />
                        <asp:TextBox ID="webSiteTxt" runat="server" size="30"></asp:TextBox>
                    </div>
                    <div class="textinsert">
                        <asp:Label ID="Label3" runat="Server" Text="<%$Resources:Email %>" AssociatedControlID="emailTxt"></asp:Label><br />
                        <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>
                    </div>
                    <div class="textinsert">
                        <asp:Label ID="Label5" runat="Server" Text="<%$Resources:Comment %>" AssociatedControlID="commentTxt"></asp:Label><br />
                        <telerik:RadEditor runat="server" ID="commentTxt" ToolsFile="~/Sitefinity/ControlTemplates/Blogs/ToolsFile.xml"
                            EnableEmbeddedSkins="True" Skin="Black" Height="160px" Width="370px" EditModes="Design">
                        </telerik:RadEditor>
                        <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>
                    </div>
                    <div class="textinsert">
                        <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!" />
                    </div>
                    <div class="textinsert" style="float: right">
                        <asp:ImageButton ID="submitBtn" runat="server" ImageUrl="~/Assets/Img/btn-comment.gif" />
                    </div>
                </div>
            </div>
        </LayoutTemplate>
    </sfWeb:CustomBlogCommentsList>

    Regards,
    Daniel
  12. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    11 Oct 2010
    Link to this post
    Hi Daniel,

    The problem is that you are calling the base. InitializeControls which is commented in the sample from the another post. You should not call the base or try executing your logic before that

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using Telerik.Blogs.WebControls;
    using Telerik.Cms.Engine;
     
    /// <summary>
    /// Summary description for BlogCommentsListCustom
    /// </summary>
    ///
    namespace Telerik.Samples
    {
        public class BlogCommentsListCustom : BlogCommentsList
        {
            public BlogCommentsListCustom()
            {
            }
     
            protected override void OnPreRender(EventArgs e)
            {
                base.OnPreRender(e);
                 
            }
     
            protected override void InitializeControls(System.Web.UI.Control controlContainer)
            {
     
                this.CommentsRepeater.ItemDataBound += new System.Web.UI.WebControls.RepeaterItemEventHandler(CommentsRepeater_ItemDataBound1);
                base.InitializeControls(controlContainer);
     
                
            }
     
            void CommentsRepeater_ItemDataBound1(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e)
            {
                if (e.Item.ItemType == System.Web.UI.WebControls.ListItemType.Item || e.Item.ItemType == System.Web.UI.WebControls.ListItemType.AlternatingItem)
                {
                    var comment = e.Item.DataItem as IComment;
                   
                }
            }
        }
    }


    Sincerely yours,
    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
  13. Daniel Plomp
    Daniel Plomp avatar
    112 posts
    Registered:
    14 Jun 2012
    11 Oct 2010
    Link to this post
    Thanks Ivan. Now I'm able to debug.
    How can I refer to the <asp:Hyperlink> inside the <sfWeb:CommandItem> section?

    This is the code, but the FindControl returns 'null':
    void CommentsRepeater_ItemDataBoundCustom(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e)
    {
       if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
       {
          //var comment = e.Item.DataItem as IComment;
          HyperLink lnkNotOke = e.Item.Controls.FindControl("lnkNotOk") as HyperLink;
          lnkNotOke.Text = "found!";
       }
    }

    I checked the controls collection(s), but it couldn't be found?

  14. Daniel Plomp
    Daniel Plomp avatar
    112 posts
    Registered:
    14 Jun 2012
    12 Oct 2010
    Link to this post
    Hi Ivan,

    Found the control.
    Well, I assume this is the right way to do it.

    private void CommentsRepeater_CustomItemDataBound(object sender, RepeaterItemEventArgs e)
    {
       try
       {
          if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
          {
             var comment = e.Item.DataItem as IComment;
             HyperLink link = e.Item.Controls[1].Controls[0].FindControl("lnkNotOk") as HyperLink;
             link.NavigateUrl = "~/blogs/niet-ok?id=" + comment.ID.ToString();
          }
       }
       catch (Exception ex)
       {
          throw ex;
       }
    }

    The only thing is that the NavigateUrl is not set by doing the above actions?

    Regards,
    Daniel
  15. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    12 Oct 2010
    Link to this post
    Hi Daniel,

    Here  is a sample code and I attached a short video that shows how it works

    template

      <sfWeb:BlogCommentsListCustom 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>
            
           <asp:HyperLink runat="server" ID="ReportAsSpam" Text="ReportAsSpam" />
             
        </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:BlogCommentsListCustom>

    control

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using Telerik.Blogs.WebControls;
    using Telerik.Cms.Engine;
    using System.Web.UI.WebControls;
     
    /// <summary>
    /// Summary description for BlogCommentsListCustom
    /// </summary>
    ///
    namespace Telerik.Samples
    {
        public class BlogCommentsListCustom : BlogCommentsList
        {
            public BlogCommentsListCustom()
            {
            }
     
            protected override void OnPreRender(EventArgs e)
            {
                base.OnPreRender(e);
                 
            }
     
            protected override void InitializeControls(System.Web.UI.Control controlContainer)
            {
     
                this.CommentsRepeater.ItemDataBound += new System.Web.UI.WebControls.RepeaterItemEventHandler(CommentsRepeater_ItemDataBound1);
                base.InitializeControls(controlContainer);
     
                
            }
     
            void CommentsRepeater_ItemDataBound1(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e)
            {
                if (e.Item.ItemType == System.Web.UI.WebControls.ListItemType.Item || e.Item.ItemType == System.Web.UI.WebControls.ListItemType.AlternatingItem)
                {
     
                    var ReportAsSpamLink = e.Item.FindControl("ReportAsSpam") as HyperLink;
                    if (ReportAsSpamLink != null)
                    {
                        ReportAsSpamLink.Target = "_blank";
                        ReportAsSpamLink.NavigateUrl = "http://www.telerik.com";
                    }
                    var comment = e.Item.DataItem as IComment;
                   
                }
            }
        }
    }


    Sincerely yours,
    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
  16. Daniel Plomp
    Daniel Plomp avatar
    112 posts
    Registered:
    14 Jun 2012
    12 Oct 2010
    Link to this post
    Hi Ivan,

    Thanks for the reply.
    I tried this, but still having issues. I created a support ticket.

    Regards,
    Daniel
Register for webinar
16 posts, 0 answered