/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BtnSi_Click(object sender, EventArgs e) { try { Tb_Clientecs _objCliente = new Tb_Clientecs(); long _Cliente_Id = long.Parse(HiddenFieldID.Value); if (_Cliente_Id == 0) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Cliente Vacio')", true); } else { bool respuesta = _objCliente.Eliminar_Cliente(_Cliente_Id); if (respuesta) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Registro Borrado Exitosamente')", true); Thread.Sleep(5000); HttpContext.Current.Response.Redirect("ListarCliente.aspx"); } else { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('El registro no se pudo eliminar')", true); } } } catch (Exception ex) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('occurrio un error ')", true); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { try { Tb_Clientecs obj = new Tb_Clientecs(); List <Tb_ClienteEstructura> listaClientes = obj.Consultar_Clientes(); GrvClientes.EmptyDataText = "No existen Clientes"; GrvClientes.DataSource = listaClientes; GrvClientes.DataBind();; } catch (Exception ex) { Console.WriteLine(ex.Message); } } }