Perform Button click event when user press Enter key in Textbox

后端 未结 7 1391
情书的邮戳
情书的邮戳 2020-12-01 07:19


&         


        
7条回答
  •  悲&欢浪女
    2020-12-01 08:17

    In the aspx page load event, add an onkeypress to the box.

    this.TextBox1.Attributes.Add(
        "onkeypress", "button_click(this,'" + this.Button1.ClientID + "')");
    

    Then add this javascript to evaluate the key press, and if it is "enter," click the right button.

    
    

提交回复
热议问题