how to activate a button when filling two textbox in a webform?

0

I have tried this code but it does not work for me, it seems that it only works for Winforms:

protected void Page_Load(object sender, EventArgs e)
{
    Mnip.Enabled = false; //BOTON DESHABILITADO
}

private void clave1_TextLeave(object sender, EventArgs e)
{
     if ((clave1.Text != "") && (clave2.Text != "")) Mnip.Enabled = true;
     else Mnip.Enabled = false;
}
private void clave2_TextLeave(object sender, EventArgs e)
{
     if ((clave2.Text != "") && (clave1.Text != "")) Mnip.Enabled = true;
     else Mnip.Enabled = false;
}

Any ideas on how to do it?

This is how I have the TextBox :

<asp:textbox TextMode = "Password" id="clave1" maxlength="4" minlength="4" placeholder="NUEVO NIP" runat="server" autocomplete="off></asp:textbox>

<asp:textbox TextMode = "Password" id="clave1" maxlength="4" minlength="4" placeholder="CONFIRMAR NIP" runat="server" autocomplete="off></asp:textbox>

And the button:

<asp:Button runat="server" name="Mnip" id= "Mnip" data-toggle="modal" disabled=false data-target="#nnm" class="btn btn-primary nav-link" text="CONFIRMAR"></asp:Button>

In fact when you press the button you should open a modal

<!--VENTANA MODAL-->
    <div class="modal fade" id="nnm" tabindex="-1" role="dialog" aria-labelledby="nmlLabel" aria-hidden="true">
      <div class="modal-dialog modal-lg" role="document">
        <div class="modal-content">
          <div class="form-group">
           <div class="modal-body">
           <h1>NIP GUARDADO CON EXITO
            <asp:Button id= "ConfNIP" runat = "server"  OnClick="ConfNIP_Click" data-toggle="modal" cssclass="btn btn-primary" style="font-size: 40px;
            font-family: Verdana,Helvetica; font-weight: bold;" Text="ACEPTAR"/></h1>
          </div>
        </div>
       </div>
    </div>

And when you press the button Aceptar of the modal you must close the session. This form is to change the password.

    
asked by sunflower 26.02.2018 в 17:10
source

0 answers