Call the special onClick button when the C # enter key is pressed

I am trying to fire a specific asp: button onclick event when I press the enter key in a specific asp: textbox control.

Another factor to consider is that the button is inside the asp: Login control template.

I do not know how to do this, suggestions on a postcard, please.

+5
source share
4 answers

You can see the property of DefaultButtonthe control panel.

+5
source

DefaultButton . DefaultButton = "btnSubmit" - :

Page.Form.DefaultButton = "btnSubmit"
+2

javascript. jQuery.

- ( , ):

$('#myTextBox').keypress(function(e){
    if(e.which == 13)
        $('#myBtn').click();
});

: , jQuery , .

, , " ", , " ", , DefaultButton asp: panel

0

All Articles