0

I am trying to implement a star rating system in Visual Studio. I cant find any standard way of doing it so I have tried this but it is rather inefficient. Can anyone tell me what I could do better.

public partial class CommentTry : System.Web.UI.Page
{
    int a = 0;   //each int is for each rating(5 different ratings for each movie)
    int b = 0;   //like actor quality, supence etc
    int c = 0;
    int d = 0;
    int e = 0;

    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        Label1.Text = "1"; //this is assigning and int value to the rating.
        a = 1;
    }

    protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
    {
         Label1.Text = "1"; 
        a = 2;
    }

enter image description here

See my problem is it is alot of image buttons. And everytime I click one the whole page refreshes. And as you can see it will be alot of lines of code for the 20 buttons. And this will be part of a much larger page as well. Any help would be much appreciated. ps. Cant see how I would enable pagin either :(

0 Answers0