Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Two submit buttons on form and Enter keypress
Message
From
13/03/2007 11:40:23
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, United States
 
 
To
13/03/2007 11:22:38
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, United States
General information
Forum:
ASP.NET
Category:
Web forms
Environment versions
Environment:
VB.NET 1.1
Miscellaneous
Thread ID:
01203011
Message ID:
01203026
Views:
12
This message has been marked as the solution to the initial question of the thread.
>I have a webform with two submit buttons. I would like to control which submit button that the Enter keypress initiates by whether there is text in certain textboxes. Anybody know how I can do this?

I added this attribute to my textbox and bingo!
TextBox1.Attributes.Add("onkeydown", "if(event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {document.getElementById('"+Button1.UniqueID+"').click();return false;}} else {return true}; ");
Very fitting: http://xkcd.com/386/
Previous
Reply
Map
View

Click here to load this message in the networking platform