here is the code in my ajax rating's onchanged event :
protected void Rating_Changed(object sender, AjaxControlToolkit.RatingEventArgs e)
{
string id = Request.QueryString["id"];
SqlConnection con41 = new SqlConnection(strConnString);
SqlCommand sorgu1v = new SqlCommand("Select * from Kisi_Film_Puan where kisi=@kisi and film=@film", con41);
sorgu1v.Parameters.AddWithValue("@kisi", (int)Session["adi"]);
sorgu1v.Parameters.AddWithValue("@film", id);
con41.Open();
SqlDataReader dr = sorgu1v.ExecuteReader();
if (dr.Read())
{
int rating = Convert.ToInt32(e.Value);
SqlConnection con4 = new SqlConnection(strConnString);
SqlCommand sorgu1c = new SqlCommand();
sorgu1c.Connection = con4;
sorgu1c.CommandType = CommandType.StoredProcedure;
sorgu1c.CommandText = "sp_UpdateKisiFilmPuan";
sorgu1c.Parameters.AddWithValue("puan", rating);
sorgu1c.Parameters.AddWithValue("user", (int)Session["adi"]);
sorgu1c.Parameters.AddWithValue("film1", id);
con4.Open();
sorgu1c.ExecuteNonQuery();
con4.Close();
}
else
{
int rating = Convert.ToInt32(e.Value);
SqlConnection con4 = new SqlConnection(strConnString);
SqlCommand sorgu = new SqlCommand();
sorgu.Connection = con4;
sorgu.CommandType = CommandType.StoredProcedure;
sorgu.CommandText = "sp_Izlenenler";
sorgu.Parameters.AddWithValue("kisi", (int)Session["adi"]);
sorgu.Parameters.AddWithValue("film", id);
sorgu.Parameters.AddWithValue("puan", rating);
con4.Open();
sorgu.ExecuteNonQuery();
con4.Close();
}
}
as you see there is nothing about rebind the datasource of label. I am wondering about should i put something, and if yes what will be the code of that rebind ? just Datalist1.Databind() ? is it enough? , or shouldnt i ?