aspx页面
<form id="form1" runat="server">
......
<asp:TextBox MaxLength="20" ID="txtSearch" runat="server"></asp:TextBox>
<asp:Button ID="btnSearch" runat="server" OnClick="btnSearch_Click" />
......
</form>
cs代码
protected void Page_Load(object sender, EventArgs e)
{
txtSearch.Attributes.Add("onkeydown", "if(event.keyCode==13){eval('window.document.form1.btnSearch.focus();');}");
}