protected void RateRecipe(object sender, CommandEventArgs e) { Rating rating = new Rating { RateDate = DateTime.Now, RatingValue = Convert.ToInt32(e.CommandArgument), RecipeRef = Request.QueryString["RecipeID"], UserRef = Context.User.Identity.GetUserName() }; string result = rating.AddRatingToDatabase(); try { Convert.ToInt32(result); lblRatingResult.Text = "Thank you for your feedback!"; Recipe recipe = new Recipe(Request.QueryString["RecipeID"]); //lblRating.Text = recipe.AvgRating.ToString("0.#"); SetRating(recipe.AvgRating); } catch { lblRatingResult.Text = result; } }