http://www.beansoftware.com/ASP.NET-Tutorials/Accept-Enter-Key.aspx
重點就是在ASP.NET 2.0 form or panel 有提供一個 defaultbutton 這個屬性,只要設定 defaultbutton ="buttonYouWant" ,當User在網頁按Enter時,就會觸發button click event 。
<form defaultbutton="button1" runat="server"> <asp:textbox id="textbox1" runat="server"/> <asp:textbox id="textbox2" runat="server"/> <asp:button id="button1" text="Button1" runat="server"/> <asp:panel defaultbutton="button2" runat="server"> <asp:textbox id="textbox3" runat="server"/> <asp:button id="button2" runat="server"/> </asp:panel> </form> |
沒有留言:
張貼留言