Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Oct 08, 2011 02:40 PM by jakenet
Aug 23, 2006 05:03 PM|LINK
Aug 24, 2006 01:09 AM|LINK
I have a page with two forms, one with just one textbox, and the other with many textboxes, dropdownlists, checkboxes, etc. This is a search page, with the results showing up in popups. The basic requirement is that if the user types in a value in the first
textbox and hits the ENTER key, the first form is submitted and a popup shows the results of the search. If the user fills in any fields in the second part of the form and hits ENTER on any textbox, the second form is submitted and the results are popped
up. The two popups are different, obviously.
I've been struggling with how to capture the ENTER key and send the user one or the other result popup. Then someone directed me to your article here. I inserted two panels enclosing the two different sets of controls into the panels. I set the defaultbutton
for the panels and tried it out. It works the first time I hit the ENTER key on any field. But if the user hits ENTER again, the first form is ALWAYS submitted. So, for example, if they didn't get the restuls they expected and went back to the main form
and added more criteria and hit ENTER, it would submit the first form, which is incorrect. The user has to refresh the page to get the second form to submit on ENTER (or click the submit button). This won't work for us. I'm wondering if this is a bug, and
if so is there a workaround? if not, what could I be missing to cause this behavior?
Thanks so much for your help - this webapp is nearly done, but this issue is causing me a lot of headaches! Hopefully this will be resolved soon.
I'm having the same problem with two
controls on the same page (Signin & Signup)
I wonder if this was forgotten when creating ASP.NET coz I can not thing on any "EZ workaround" (as it was so EZ 2 implement on classic ASP)
any ideas ?
code samples ?
(hate to mess with all those low level events :-)
Aug 24, 2006 10:47 AM|LINK
Yovav:> I'm having the same problem with two
controls on the same page
Just an idea, not checked:
DefaultButton='<%= MyControl.FindControl("MyControlButton").ClientID %>'
Let me know.
Aug 24, 2006 04:49 PM|LINK
Another sample code (to be applied on each control):
So now - whenever the control area is being clicked (or focused) or any control inside it - the default button will used,
It will not go to a default button if the focus is outside of these two controls (for example - on the web site header) - the following script might also B useful:
if (window.event.keyCode == 13)
Aug 28, 2006 05:09 AM|LINK
After much seraching, I found a workable solution to this problem. Basically we need to manually set up the same client code that would be injected if we were using a Default button for a panel.
Assume we have a <asp:Login ... /> control on a page named "Login1"
In the Page_Load event handler:
Control ctl = Login1.FindControl("LoginButton");
if(ctl != null && ctl
Sep 01, 2006 04:31 PM|LINK
Hi, In my site also this is the problem. in my site i am using master pages and in the master page i have a usercontrol in the usercontrol i have an image button. and when i go to login page in that login page i used a login control. when i open login page
and enter the user name and password and hit enter then the search button gets fired. so i searched for this in the forms but i didint find any information regarding this. so can you please help me regarding this.
Sep 19, 2006 09:20 PM|LINK
Folks, you have to remember that not everyone is using old login controls. We are using the new .NET 2.0 Membership API. Thus .NET provides the button and textboxes. Plus, if you're using master pages, you can't simply play around with defaultbutton because
what button are you referring to if you are using a master page? that is not possible as differrent detail pages will have it's own button!
This is stupid, there must be an easy workaround.
Sep 20, 2006 06:00 AM|LINK
Can you provide the WebForm_FireDefaultButton client script.
Sep 20, 2006 06:02 AM|LINK
If u find any solution for this, can u please suggest me to solve this problem.
Sep 20, 2006 04:05 PM|LINK
This is something you should be able to do. I had a boss who insisted on it, rather than just disabling the enter key. It should be textbox driven though, its not a good idea to use Panels just for this purpose, unless you use them anyway for other reasons.
So this can be used at the FORM level and PANEL level. Where else? Textbox (or other control) would be ideal.
You may have a reason to point one textbox to one button and another textbox to another button.