Author: longlongtime | Posted on: 7/23/2010 4:06:03 AM | Views : 447

On my page I have a list of items with ajax rating controls next to them. These controls I create dynamically from Page_load where I give the rating controls the rating of each corresponding item from the database. The problem is now that when the rating-event is fired I want to go to my event handler och add the new rating of the selected item into my database, but between my click and the event handler-method is fired the Page_load method is run, where all ratings is set from the database again, which means that the new rating I clicked on was restored and that the new rating I was supposed to update my database with will be the old rating already in the database. 


I create my ratings like this:
SqlDataReader r = cmd.ExecuteReader(); //calling a stored procedure

RadRating rating = new RadRating();
rating.Rate += new System.EventHandler(rating_Click);
rating.ID = r["id"].ToString();
rating.AutoPostBack = true;  ...

Go to the complete details ...