Basic question

G

Guest

Hi,
How can I make a default button in asp.net for a web form? (when I press
ENTER it calls the event click of the button) thnks.
 
K

Kevin Spencer

That would be the Submit button. However, unless the cursor is in a form
field, it will not be fired. To do that, you would have to handle the
KeyDown event for the document object in the HTML DOM.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
We got a sick zebra a hat,
you ultimate tuna.
 
A

Alex D.

thats correct. though normally you need to submit the page after entering
some data in a form field, so the cursor or focus will be in a form field
most of the time.

Kevin Spencer said:
That would be the Submit button. However, unless the cursor is in a form
field, it will not be fired. To do that, you would have to handle the
KeyDown event for the document object in the HTML DOM.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
We got a sick zebra a hat,
you ultimate tuna.
 
K

Kevin Spencer

I seem to recall mentioning something about that somewhere...

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
We got a sick zebra a hat,
you ultimate tuna.


Alex D. said:
thats correct. though normally you need to submit the page after entering
some data in a form field, so the cursor or focus will be in a form field
most of the time.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,678
Members
48,796
Latest member
Greg L.

Latest Threads

Top