默认按钮停止工作 [英] default button stops working

查看:81
本文介绍了默认按钮停止工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为我的客户门户网站创建一个Web表单.此表单利用了一个用户控件(也是我写的),该控件将在需要时显示一个面板(也使用ModalPopupExtender)进行用户交互.在显示然后隐藏了所述面板之后,当按下Enter键时,表单的提交"按钮不再触发其单击事件.面板本身包含几个UpdatePanels,以执行一些Ajax功能,如果这样做有助于充实整个图片.

是否有人对我如何确保当用户控件隐藏上述面板时按下Enter键时会触发默认按钮动作有任何建议?我希望它成为用户控件代码的一部分,这样控件的用户就不必记住要做额外的步骤.

I am working on a web form for my client''s portal. This form utilizes a user control (also written by me) that will, when needed, display a panel (which also makes use of the ModalPopupExtender) for user interaction. After I have shown then hidden said panel, the form''s "submit" button no longer fires its click event when the Enter key is pressed. The panel itself contains a couple of UpdatePanels in order to do some Ajax functionality, if that helps flesh out the whole picture.

Does anyone have any suggestions on how I can ensure that when the User Control hides the aforementioned panel the default button action is fired when the Enter key is pressed? I would prefer it to be part of the User Control''s code so that users of the control do not have to remember to do an extra step.

推荐答案

I会说,当您隐藏面板时,再添加一行代码,这将把焦点设置在用户控件的控件之一上,该控件将使浏览器知道按Enter键时将触发默认按钮的焦点在哪里.
希望对您有所帮助.
I would say, when you hide the panel add one more line of code which would set focus on one of the control of user control which would let the browser know where is the focus now to fire default button when pressing enter.

Hope this helps.


尝试设置面板的defaultButton属性.
Try to set the defaultButton property of the panel.
<asp:Panel DefaultButton="MyBUttonId" />


这篇关于默认按钮停止工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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