protected void btnCancelar_Click(object sender, EventArgs e) { if (txtComentario.Text.Trim() == "") { UI.Mensaje("Avisos", "Debe especificar un comentario para cancelar el Aviso.", "", Page); return; } using (CobranzasDataContext db = new CobranzasDataContext()) { int idAviso = Convert.ToInt32(Request["idAviso"]); Entidades.Avisos Aviso = db.Avisos.Single(x => x.idAviso == idAviso); Aviso.FechaCancelado = DateTime.Now; Aviso.Comentario = txtComentario.Text; try { db.SubmitChanges(); ScriptManager.RegisterStartupScript(Page, typeof(Page), "ini", "window.parent.CerrarAviso();window.parent.Avisos_Actualizar();", true); } catch (Exception Ex) { UI.Mensaje("Avisos", Ex.Message, "", Page); } } }