Associate Comments and Reviews widgets with an item

You manage the comments and reviews in your website with the Comments and Reviews widgets. You use these widgets for enabling users to leave comments on pages.

In addition, you can associate the widgets with particular item, for example, news, blogs, and so on. To do so, you use the helper methods for associating Comments and Reviews widgets with an IDataItem.

Add comments count and average rating

Use the following helper method to include information how many comments are added by users and what is the average rating of an item:

@using Telerik.Sitefinity.Frontend.Mvc.Helpers;
@Html.CommentsCount(navigateUrl, @Model.Item.DataItem)

In the code above:

  • navigateUrl is URL, to which the Leave comment, Write rating, and the count symbol redirect
  • @Model.Item.DataItem is an instance to the IDataItem to which you associate the Comments widget

The following table illustrates how the helper method works.

Scenario Comments Reviews
No comments or ratings are submitted No comments link No reviews link
Submitted comments and rating Comment count Avarage rating

Add comments and reviews

Use the following helper method to add comments or reviews that are associated with the particular IDataItem:

@using Telerik.Sitefinity.Frontend.Mvc.Helpers;

NOTEDepending on whether you enabled user rating and comments for the item, Sitefinity CMS automatically detects whether reviews and comments should be displayed for this item. 
For more information, see Administration: Administration: Enable comments and ratings.

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Get started with Integration Hub | Sitefinity Cloud | Sitefinity SaaS

This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.

Web Security for Sitefinity Administrators

This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?