You can manage easily the comments in your website with the Sitefinity CommentsWidget and CommentsCountControl.
In order to use these controls in your template, you must add the following reference:
<%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Modules.Comments.Web.UI.Frontend" TagPrefix="comments" %>
Here is a small example how you can add CommentsWidget in template:
ThreadKey='<%# ControlUtilities.GetLocalizedKey((Guid)Eval("Id")) %>' />
When you set the ThreadKey property of the CommentsWidget you ensure that the comments submitted in this CommentsWidget will be stored in the specified thread. This will allow you to have more than one CommentsWidget on the same page and they will display different comments - just set two different ThreadKey-s to each widget. This could be useful if you want to allow your users to comments different items displayed in the same page.
By setting the ThreadKey like this:
you will ensure that the CommentsWidget is associated with different threads for every translation that you have. This way you can have completely different comments for the different translations of your items.
Furthermore you have the option to set GroupKey property of the CommentsWidget. This will specify the group associated with the thread.
Also you can set the ThreadType property of the CommentsWidget. This property will associate the widget with some item type and then you will be able to control the thread settings through the Administration-> Settings-> Advanced-> CommentsModule->CommentableTypes
If you don’t set any of these properties your CommentsWidget will be automatically associated with the current page. We will create new thread for this CommentsWidget as soon as the first comment is submitted. In this case if you drop two CommentsWidget-s on the same page they will display the same comments.
Notice that if you want to have two different items with the same list of comments you can just set the ThreadType and GroupKey for both CommentsWidgets- to the same values.
Here is an example how you can add CommentsWidget in the details template for NewsItem and associate its type with the current news item:
ThreadKey='<%# ControlUtilities.GetLocalizedKey((Guid)Eval("Id")) %>'
ThreadTitle='<%# Eval("Title") %>'
ThreadType='<%# Container.DataItem.GetType().FullName %>'
GroupKey='<%# ControlUtilities.GetUniqueProviderKey("Telerik.Sitefinity.Modules.News.NewsManager", Eval("Provider.Name").ToString()) %>' />
In Sitefinity CMS there is a separate control which displays the comments count associated with particular thread.
With the following snippet you can add CommentsCountControl to your templates:
In order to use this control you should specify its ThreadKey property - it is used for associating the count with the specific thread.
Also you can set NavigateUrl to this control so you can modify the default redirection.
There are three display modes for this control:
AllowComments='<%# Eval("AllowComments") %>'
ThreadType='<%# Container.DataItem.GetType().FullName %>'/>
Back To Top