Tom*_*Tom 3 asp.net triggers updatepanel keypress
我有一个带有更新面板的页面,其中包含一个小的登录表单 - 当用户单击提交按钮时它运行正常,但如果用户在输入密码后按下返回键,则它不会运行.
这是代码......
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="loginButton" EventName="Click" />
</Triggers>
<ContentTemplate>
<asp:TextBox ID="username" MaxLength="11" runat="server" />
<asp:TextBox ID="password" MaxLength="64" runat="server" TextMode="Password" />
<asp:LinkButton ID="loginButton" OnClick="Submit_login" runat="server" Text="<img src='login.png' alt='Login' />" />
</ContentTemplate>
</asp:UpdatePanel>
Run Code Online (Sandbox Code Playgroud)
如果您在"内容"模板中添加了一个面板并指定了该面板DefaultButton,则应在用户按Enter键时提交该按钮.
<ContentTemplate>
<asp:panel id="p" runat="server" defaultbutton="loginButton">
//Form here with loginButton
</asp:panel>
</ContentTemplate>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3971 次 |
| 最近记录: |