IntroductionEver wanted to build a content rating system for your site? This article shows you how you can implement a content rating system for your Microsoft Content Management Server (MCMS) 2002 web site.
In this article, we will take a look at how to setup the database for rating entries, adding the ratings through code, and how to aggregate the information back to the audience in an informative and eye pleasing graphical view.
There are a number of ways that this can be accomplished. In my example, the rating system will be implemented as an ASP.NET user control that lives on your MCMS template. When a user views the page, they will be able to give a rating for the posting, view the average rating, the number of reviews, and a graphical representation (bar chart) of the ratings for that posting.
By the end of this article you will have created a user control that you can drop on any of your MCMS templates and will look similar to the following images:
Figure 1. The above image shows the "Rate Content" link in the upper right corner Figure 2. View of the rating form after the user clicks on the "Rate Content" link.
In this article, we will look at the following
Let’s get started!
Creating the Database
The first thing we need to do is setup the database that will be used for tracking the ratings. Why a separate database? Why can we not just add this new table to the MCMS database? The answer to that is quite simple…it’s not recommended nor supported to house other tables within your MCMS database.
Note: Another optional feature you might want to consider is a comments field so users can enter comments. Ensure you add a column for the comments if you want to track that as well.Creating the control
In this section we will go over the features that we want to implement for this rating system and then tie them all together in a user control.The first thing you need to ask yourself is “What do I want this to look like”? In my example, I want to ensure I have the following features:
Now that I know what I want in my control, it’s time to write code!
Creating the Interface for the Rating System
Creating the Routines for the Rating System
Now that we have our look and feel, its time to build in the functionality. Lets switch to code view and begin!
Implementing the control
The last thing to do will be to implement the control.
Conclusion
In this article you have seen how to create a content rating system for MCMS 2002. You may have decided to implement this in a different fashion, but you know have the concepts to move forward. Here are some things that you may want to consider as you refine your own content rating system:
Complete Code
Download the complete code here.
This posting is provided "AS IS" with no warranties, and confers no rights.