コード例 #1
0
        protected void grdNoticias_DeleteCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
        {
            if (Session["Usuario"] == null)
            {
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "mykey", "CancelEdit();", true);
            }

            try
            {
                NoticiasWCFClient objNoticiasWCF = new NoticiasWCFClient();
                objNoticiasWCF.Noticia_Eliminar(Convert.ToInt32(((GridDataItem)e.Item).GetDataKeyValue("idNoticia")), ((Usuario_LoginResult)Session["Usuario"]).idUsuario);
                Noticias_Cargar(int.Parse(cboEmpresa.SelectedValue), txtBuscar.Text);

                lblMensaje.Text     = "La noticia se eliminó con éxito";
                lblMensaje.CssClass = "mensajeExito";
            }
            catch (Exception ex)
            {
                lblMensaje.Text     = "ERROR: " + ex.Message;
                lblMensaje.CssClass = "mensajeError";
            }
        }