用javascript写,后台并不知道什么时候按了回车。

解决方案 »

  1.   

    只需要在form的InitializeComponent()函数中加一句话就可以了
    this.Enter += new System.EventHandler(this.button1_Click);
      

  2.   

    javascript写或者在C#中有registerclientblock发送到前台,也可以
      

  3.   

    最简单的就是当你敲回车的时候吧focus放到那个按钮上。回车的code是13
      

  4.   

    如果是B/S结构,并且是在当前页面,用JAVASCRIPT实现。
      

  5.   

    <input onkeydown="gosub()" type="text">
    javascript:
    function gosub()
    {
    if( event.keyCode == 13 )
    {
    document.all.Button1.click();
    }
    }
      

  6.   

    <input onkeydown="gosub()" type="text">
    javascript:
    function gosub()
    {
    if( event.keyCode == 13 )
    {
    document.all.Button1.click();
    }
    }
      

  7.   

    stoway(X.G.Z)正确。也可以这样。
    <input type="text" id="txt1" onkeydown="javascript:if (event.keyCode==13) {document.all.btnQuery.click();return false;}">
    <input type="button" id="btnQuery" name="Button1" value=" 查 询 ">enjoy!