Add a Comments widget and Comments counter in a template
You can manage the comments in your website with the built-in CommentsWidget and CommentsCountControl.
PREREQUISITES: To use the CommentsWidget and CommentsCountControl widgets, in your template you must add the following reference:
<%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Modules.Comments.Web.UI.Frontend" TagPrefix="comments" %>
Add the Comments widget
The example below displays how to add CommentsWidget in the details templates for News items and associate its type with the current news item. It has the following properties:
If you do not set the GroupKey and the ThreadType properties your CommentsWidget is automatically associated with the current page. Sitefinity CMS creates a new thread for this CommentsWidget when the first comment is submitted. In this case, if you drop two CommentsWidget on the same page they display the same comments.
NOTE: If you want to have two different items with the same list of comments, you can set the ThreadType and GroupKey for both CommentsWidgets to the same values.
Add comments count
Sitefinity CMS has a separate widget that displays the count of the comments associated with particular thread.
The example below displays how to add the CommentsCountControl in News template.
It has the following properties:
- ThreadKey property
To use the widget, you must specify its ThreadKey property. Sitefinity CMS uses it to associate the count with the specific thread.
- NavigateUrl property
You can use the NavigateUrl property to modify the default redirection.
- DisplayMode property
Sitefinity CMS has the following display modes for this widget:
Use the following template example: