错误的按钮焦点在键盘上的输入按钮 [英] wrong button focus at keyboard enter button

查看:63
本文介绍了错误的按钮焦点在键盘上的输入按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个登录页面,在该页面上,照例有两个用于输入用户名和密码的文本框,以及一个用于登录的按钮.
我已将此页面与母版页面附在一起,其中使用了一个按钮即注册按钮.
当我在填写完字段后从键盘按Enter时,应聚焦登录按钮,但它将再次转到注册页面
问题出在哪里?

I have a login page on which a have 2 text box as usual for username and password and one button for login.
i have attached this page with master page in which one button is used that is sign up button.
when i press enter from keyboard after filling the fields it should focus login button but it is going to the signup page again
where is the problem?

推荐答案

登录页面集的页面加载集中于登录按钮对象

loginButtonObject.Focus();
on page load of login page set focus on login button object

loginButtonObject.Focus();


没有看到您的代码,这有点困难.我只能建议您使用以下属性,使浏览器以所需的方式提交表单:

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.button.usesubmitbehavior.aspx [,而注册按钮应具有UseSubmitBehavior="false"

这应该告诉浏览器在按下Enter键时使用登录按钮提交表单.
Without seeing your code it''s a bit difficult. All I can suggest is that you use the following property to make the browser submit the form in the way you want:

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.button.usesubmitbehavior.aspx[^]

Your login button should have UseSubmitBehavior="true" and the signup button should have UseSubmitBehavior="false"

This should tell the browser to submit the form using the login button when you press enter.


您好,


在页面加载中,将您的登录按钮ID绑定为默认值.

这是下面的语法,

Hi,


In your page load, bind your login button id as default.

here is the below syntax,

Page.Form.DefaultButton = btnLogin.UniqueID;



在这里,用btnLogin代替,输入您的登录按钮ID.

希望这会有所帮助.



Here, in the place of btnLogin, give your login button id.

Hope this helps.


这篇关于错误的按钮焦点在键盘上的输入按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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