prathyusha

prathyusha

  • NA
  • 180
  • 72.8k

how to count the rating value using rating control

Jan 2 2013 11:59 PM
hi
protected void BindRatingControl()
    {
        int total = 0;

        DataTable dt = new DataTable();
        con.Open();
        //SqlCommand cmd = new SqlCommand("Select Rate from tbl_ratei", con);
        //SqlDataAdapter da = new SqlDataAdapter(cmd);
        //da.Fill(dt);
        cmd = new SqlCommand();
        cmd.Connection = con;
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.CommandText = "sp_getratingcount1";
        cmd.Parameters.AddWithValue("@sno", "0");
        cmd.Parameters.AddWithValue("@Name", "0");
        SqlDataAdapter da = new SqlDataAdapter(cmd);
        da.Fill(dt);
        if (dt.Rows.Count > 0)
        {
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                total += Convert.ToInt32(dt.Rows[i][0].ToString());
            }
            int average = total / (dt.Rows.Count);
            Rating1.CurrentRating = average;
            Label4.Text = dt.Rows.Count.ToString();
        }
    }
by using above method it counts the rate value for all but i want to count individual in gridview like justdial when search for hotels in justdial it display all and i want rate particular that hotel rating will be increase how? please help me