问题描述:

This question already has an answer here:

  • Perform Button click event when user press Enter key in Textbox

    6 answers

网友答案:

You can wrap the field and button in a Panel and use the DefaultButton property.

For example:

<asp:Panel ID="panel1" runat="server" DefaultButton="Btn1">
    <asp:TextBox ID="TxtPost" runat="server"></asp:TextBox>
    <asp:Button ID="Btn1" runat="server" />
</asp:Panel>
相关阅读:
Top