按下Enter键后,不需要在按钮上调用onClick事件

问题描述

| 网页我有textBox和按钮。 我添加了onClick for按钮。 问题是,如果我在textBox中单击Enter,它也会为按钮调用onClick事件。我明白为什么。 我的代码在这里: TextBox在视图中:
                      <asp:View ID=\"BlView\" runat=\"server\">
                           <p class=\"tabHead\"> BLACK LIGHT LABEL DATA </p>
                            <table class=\"tab\">
                                <tr>
                                    <td>
                                        <asp:Label ID=\"Label1\" runat=\"server\" class=\"label\" Text=\"BARCODE\" />
                                    </td>
                                    <td>
                                        <asp:TextBox ID=\"bl_tb_barcode\" runat=\"server\" BorderWidth=\"1px\" 
                                            class=\"textBox\"  Width=\"700\"/>
                                    </td>
                                </tr>
                            </table>
                     </asp:View> 
按钮代码在这里:
       <div class=\"divPrinter\">
        <asp:DropDownList runat=\"server\" class=\"dropDownList\" Width=\"250\" Height=\"35\" 
            ID=\"cbPrinters\" style=\"margin-top:80px\"/>
        <asp:Button ID=\"btnPrint\" runat=\"server\" class=\"btnPrint\" style=\"margin-top:80px\"
            Width=\"120\" Height=\"35\"  Text=\"Print\" onclick=\"BtnPrintClick\"  />
        </div>
    

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)