Set Default Button for the Enter Key

evad4682

Well-known member
Joined
Nov 7, 2005
Messages
55
Programming Experience
Beginner
How do I set the button that is controlled by the enter key? I have a text box and once that text box is populated I would like to have the ability to press the enter key instead of clicking a button. I have tried a couple of things:

ClientScript.RegisterHiddenField("_EVENTTARGET", "Button1")
Page.RegisterHiddenField("_EVENTTARGET", "Button1")

Neither of these seems to be working. Does it matter that the machines that will be running my app may have an earlier version of the .NET framework than my development pc?

Thanks Everyone.


 
There are 2 underscores starting __EVENTTARGET and not 1 like you typed.

 
Thanks John. I was still unable to get that to work. I ended up going with:

Page.Form.DefaultButton = btnGo.UniqueID


Thanks again for the help John.
 
Back
Top