Click here to Skip to main content
15,887,485 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
Posted
Comments
Sergey Alexandrovich Kryukov 19-Oct-12 12:40pm    
You say "stops working", not "not working". When it was working and when was not. How about some code samples for both cases?
--SA
TimWallace 19-Oct-12 13:18pm    
Sergey,

There are too many layers of inheritence in my client's framework to be able to give you a representive sample. Suffice it to say that prior to showing/hiding the panel, if I press the Enter key the "submit" button's clicked action is fired. After showing/hiding the panel, one has to click the button with the mouse, the action is not triggered by pressing the Enter key.
Sergey Alexandrovich Kryukov 19-Oct-12 14:14pm    
Well, then I would classify it as "not enough information". Don't you see it's not enough?
--SA
TimWallace 19-Oct-12 14:35pm    
Thanks for your help. Have a great weekend.
Sergey Alexandrovich Kryukov 19-Oct-12 14:53pm    
I wish I could really help this time.
Thank you, have a great weekend, too.
--SA

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.
 
Share this answer
 
Try to set the defaultButton property of the panel.
<asp:Panel DefaultButton="MyBUttonId" />
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900