I have a problem with a button, it has an OnClick event but it does not enter the function that is programmed in C #.
protected void Page_Load(object sender, EventArgs e)
{
btn_agregarCentro.Click += new EventHandler(this.btn_agregarCentro_Click);
}
protected void btn_agregarCentro_Click(object sender, EventArgs e)
{
//no entra al evento
Button cliqueado = (Button)sender;
cliqueado.Text = "clickeado";
cliqueado.Enabled = false;
}
Above the code that is in c #, in the asp I have the following button:
<%@ Page Title="" Language="C#" MasterPageFile="~/Program.Master" AutoEventWireup="true" CodeBehind="Compras.aspx.cs" Inherits="Program.Compras.ComprasIn" EnableEventValidation="false" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<asp:ScriptManager ID ="ScriptManager1" runat="server" EnablePageMethods="true"></asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<section class="content">
<div class="row">
<div class="col-md-4">
<div class="box box-danger">
<div class="box-body">
<div class="row">
<div class="col-md-12">
<h4>Procentajes</h4>
<form class="form-horizontal">
<div class="form-group">
<div class="col-sm-8">
<asp:Button ID="btn_agregarCentro" CssClass="btn btn-default" Text="Agregar" OnClick="btn_agregarCentro_Click" runat="server"/>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
The button never enters the function
btn_aggregateClick_Center
What could be the problem?