如何在登录页面中按Enter提交页面? [英] How do I submit page by pressing enter in login page?

查看:103
本文介绍了如何在登录页面中按Enter提交页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何直接按Enter键提交页面?
我输入了用户名和密码,然后按Enter.它不起作用.
它只能通过单击或按Tab并输入...来工作.
这是一个c#窗口应用程序..

How can i submit my page by pressing enter button directly?
I entered username and password, and pressed enter. it is not working.
It is working only by clicking or pressing Tab and Enter...
It is a c# window application..

推荐答案

您需要为页面添加"DefaultButton" 属性.

ASP.NET 2.0为您的问题引入了一个很好的解决方法.通过简单地将"defaultbutton"属性指定为要触发事件的<asp:Button>的ID,即可完成工作.
可以在form标记的Form级别以及<asp:panel>定义标记的面板级别指定defaultbutton属性.在面板级别指定时,对于面板内部的那些控件,将覆盖表单级别设置

示例示例:
You need to add "DefaultButton" property for the page.

ASP.NET 2.0 introduces a wonderful work around for your issue. By simply specifying the "defaultbutton" property to the ID of the <asp:Button>, whose event you want to fire, your job is done.
The defaultbutton property can be specified at the Form level in the form tag as well as at panel level in the <asp:panel> definition tag. The form level setting is overridden when specified at the panel level, for those controls that are inside the panel

Sample example:
<form id="Form1"
    defaultbutton="SubmitButton"
    defaultfocus="TextBox1"
    runat="server">


尝试使用此控件,而不要使用按钮

< input type ="Sumit" value ="OK" name ="but1" onclick ="But1_Click()">

希望对您有帮助


如果您得到答案,请给我评分

谢谢

DX-ARMY
try this control instead of using button

<input type="Sumit" value="OK" name="but1" onclick="But1_Click()">

hope it will help you


if you get the answer then rating me

thanks

DX-ARMY


这篇关于如何在登录页面中按Enter提交页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆