Title: How to use Rating Control in SharePoint 2010
Details: Some thing and finally some thing every one really wanted. Either you download code from codeplex or use any 3rd party controls - its takes about week or more for you to create a Rating Control that is customized to your needs. Now, we have this out of the box in SharePoint 2010 and here is how you use it.
How-To: Lets begin with setting up Rating Control for a Custom List first.
Step # 1 Enable / Start the 'User Profile Service' from the CA > System Settings > Servers > Manage services on server ( by default it is Started ). |
|
Step # 2 Under CA > Monitoring > Timer Jobs > Review Job Definitions > look for 'User Profile Service Application - Social Data Maintenance Job' and
'User Profile Service Application - Social Rating Synchronization Job'.
These jobs are scheduled by default to run every 1 hr. |
|
Step # 3 For our convenience and testing, schedule both these jobs to run every 1 min as shown below. Also do the same for
'User Profile Service Application - Social Rating Synchronization Job' |
|
Step # 4 Ok you are now all set. Go to the List level ( your desired List / Doc Lib ) and get to the List Settings |
|
Step # 5 Select the Rating Settings on the General Settings option and choose the option 'Yes' for 'Allow items in this list to be rated?' |
|
Step # 6 Once you choose this option, 2 new columns will be added to your list as shown below |
|
Rating (0-5) will give you the 5 star rating asynchronous control that you can rate any item for. Number of Ratings will display how many unique users rated the item.
Remmember that if same user rates twice, it will override his / her previous rating
( and will not aggregate ).
Rating control will average ratings of unique users rating on item basis. |
Step # 7 User ratings are collected asynchronously as shown below. |
|
Step # 8 Once you submit rating, you will be also shown the success message. |
|
Step # 9 Wait for a minute since the timer jobs is set to run for every 1 min as configured earlier. View the list webpart and notice that the ratings will be changed. |
|
Step # 10 Perfect! Lets now see how to use this Rating Control on a Page. First we need the Page level register tag. |
<%@ Register Tagprefix="SharePointPortalControls" Namespace="Microsoft.SharePoint.Portal.WebControls" Assembly="Microsoft.SharePoint.Portal, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
|
Step # 11 Once you register the Control Tag, use the below control code and add it to the PlaceHolderMain section. Make sure that the FieldRef Name matches the column name. You are all set now. |
<SharePointPortalControls:AverageRatingFieldControl id="PageRatingControl" FieldName="Rating (0-5)" runat="server" />
|
Comments
I have created a discussion and apply rating to it.
i can see the rating control now, but it is not retriving the value of each post/reply. Also if i am trying to rate it. it shows message 'item is currently unrated. Press SHIFT +ENTER to enter rating'.
and its not wrking too...
what is data type of rating column? is it int/decimal??
@K2: Did you get the solution?