Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Two submit buttons on form and Enter keypress
Message
De
13/03/2007 11:40:23
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, États-Unis
 
 
À
13/03/2007 11:22:38
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires Web
Versions des environnements
Environment:
VB.NET 1.1
Divers
Thread ID:
01203011
Message ID:
01203026
Vues:
11
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/
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform