Blog rating in sitefinity 4.2 - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

Blog rating in sitefinity 4.2

  • Blog rating in sitefinity 4.2
  • Can anyone tell me how to do blog rating in sitefinity 4.2?
  • Hi Chirag,

     Here's what you can do - : you can use RadRating control for ASP.NET AJAX:
    http://demos.telerik.com/aspnet-ajax/rating/examples/gridrating/defaultcs.aspx

    You have to implement custom control that will have a client part and ListView (or another control) with BlogPosts, that will wrap rad rating control in the Item Template.

    The average rating result need to be calculated at wrapper rating control like:

    var averageRating = ratedItem.VotesSum / (ratedItem.VotesCount != 0 ? ratedItem.VotesCount : 1);
    //load the value
    this.RatingControl.Value = (double)averageRating;

    On the client  you need to implement a method that will invoke service to update VotesCount and VotesSum into the database (these could be custom fields of the BlogPosts).

    Kind regards,
    Svetoslav Petsov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  • Hi, could you expound more on how this is done:
    "On the client  you need to implement a method that will invoke service to update VotesCount and VotesSum into the database (these could be custom fields of the BlogPosts)."

    Thanks.
  • Hi Jkregala,

     After you have calculated the average result of the Rating control, you can send it to the server using jquery to consume a POST service that will later update the two custom fields of the Blog Posts with the data from the service (which will be the VotesCount and the VotesSum).
    Please check this blogpost for information on how to consume the service using jquery:
    http://pranayamr.blogspot.com/2011/03/rest.html
    Also, in order to update the custom fields you can use the DataExtensions.SetValue method:

    Telerik.Sitefinity.Model.DataExtensions.SetValue(blogPost
    , "VotesSum", SumValue);
                
    Regards,
    Svetoslav Petsov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items