Add comments widget and counter in a widget template

You can manage easily the comments in your website with the Sitefinity Comments widget and CommentsCount widget.

PREREQUISITES: To use these controls in your template, you must register Telerik.Sitefinity.Modules.Comments.Web.UI.Frontend namespace.

Add Comments widget

When you add the Comments widget, you need to configure the following properties:

ThreadKey property

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 you 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.

GroupKey property

Furthermore, you have the option to set GroupKey property of the CommentsWidget. This will specify the group associated with the thread.

ThreadType property

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 do not 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.

NOTE: 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.

Add Comments count widget

In Sitefinity CMS there is a separate control which displays the comments count associated with particular thread.

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:

  • DisplayMode="ShortText"

  • DisplayMode="FullText"

  • DisplayMode="IconOnly"

Following is an example how you can add Comments widget and the Comments count widget in the details template for NewsItem and associate its type with the current news item:

Want to learn more?

Sign up for our free beginner training. Boost your credentials through advanced courses and certification.
Register for Sitefinity training and certification.

Was this article helpful?