老大们,你们知道我做了一个提交,我怎么让在文本框中输入完文字后回车就直接提交了提交按钮是imagebutton,用的是imagebutton的onclick事件,可是客户要回车也可以,请问怎么做?

解决方案 »

  1.   

    TextBox1.Attributes.Add("onkeydown","if(event.keyCode==13){document.all.ImageButton1.click();return false;}")
      

  2.   

    TextBox1.Attributes.Add("onkeydown","if(event.keyCode==13){document.all.ImageButton1.click();return false;}");
      

  3.   

    <asp:TextBox id="TextBox1"  runat="server"></asp:TextBox>
    <asp:ImageButton id="ImageButton1" runat="server"></asp:ImageButton>
    ************
    private void Page_Load(object sender, System.EventArgs e)
    {
    this.TextBox1.Attributes.Add("onkeydown","if(event.keyCode==13){"+Page.GetPostBackClientEvent(this.ImageButton1,"click")+"}");
    }