protected override void Render(HtmlTextWriter writer) { Literal lit = new Literal(); lit.Text = RenderRating(); if (Enabled) { CallBackContent cbContent = new CallBackContent(); cbContent.Controls.Add(lit); cb.Content = cbContent; cb.RenderControl(writer); } else { lit.RenderControl(writer); } }
private void cb_Callback(object sender, CallBackEventArgs e) { Data.Topics db = new Data.Topics(); if (e.Parameters.Length > 0) { int rate = Convert.ToInt32(e.Parameter); if (rate >= 1 && rate <= 5) { RatingValue = db.Topics_AddRating(TopicId, UserId, rate, string.Empty, HttpContext.Current.Request.UserHostAddress.ToString()); } } CallBackContent cbContent = new CallBackContent(); cbContent.Controls.Add(new LiteralControl(RenderRating())); cb.Content = cbContent; cb.Content.RenderControl(e.Output); }