我有一个asp.net登录控件。它工作正常,但您必须按实际按钮登录才能登录。如果用户也按下回车,我想这样做。怎么办呢?
答案 0 :(得分:1)
答案 1 :(得分:0)
不确定这是否是您要查找的内容,但请查看AccessKey property
答案 2 :(得分:0)
有一些解决方法。看看代码片段。 (无需添加面板控件)
protected void Page_Load(object sender, EventArgs e)
{
TextBox Password = (TextBox)Login1.FindControl("Password");
Button ButtonLogin = (Button)Login1.FindControl("LoginButton");
Password.Attributes.Add("onKeyPress", "javascript:if (event.keyCode == 13) __doPostBack('" + ButtonLogin.UniqueID + "','')");
}