Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

HI ALL ! i want to provide rating of items of a sharepoint 2010 list from a grid view hat is showing all the list items in a grid with branding . is there any way to add a rating column in a grid with Social Rating Control (yellow , blue & empty stars)??

please suggest me any workaround about this issue.. thanks in advance!!

share|improve this question
add comment

2 Answers 2

1 way in can think of is using a GridView's OnRowDataBound event. In your grid, include an empty column, with say a Panel in it. Give the panel an ID.

Then using something like this, find the panel in the grid, and using the value of the rating field of the current item being bound, add images:

void YourGrid_RowDataBound(Object sender, GridViewRowEventArgs e)
{
  if(e.Row.RowType == DataControlRowType.DataRow)
  {
    SPListItem item = (SPListItem)e.Row.DataItem;
    Panel stars = e.Row.Cells[?].FindControl("StarsPanel") as Panel;
    if(stars != null)
    {
      int rating = 0;
      int.TryParse(item["Rating"].Tostring(), out rating);
      for(int i = 0; i < rating)
      {
        //add images
      {
    }
  }
}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.