default button and enter

A

Anton ml. Vaheie

Hi,

Can somebody tell me how to convince explorer that my "button" will be
pressed when I press Enter - in other words that it will be default button.
Just like in windows forms. I use web form button.

Thanks,
Anton
 
J

Jos

Anton said:
Hi,

Can somebody tell me how to convince explorer that my "button" will be
pressed when I press Enter - in other words that it will be default
button. Just like in windows forms. I use web form button.

Thanks,
Anton

Make it an HTML submit control, instead of an HTML button or a Web Control
button.
Don't forget to replace OnClick by OnServerClick.
 
S

Sriram

Hi Anton,
Here is the code snippet you need to add in your page load
event (serside)

Page.RegisterHiddenField("__EVENTTARGET","btnSave");

In the above line, btnSave is my default button to save my data on the
form. This "RegisterHiddenField" to allows server controls to
automatically register a hidden field on the form. The field will be
sent to the Page when the HtmlForm server control is rendered.

I hope this will help you.

-Sri.
 

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

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,054
Latest member
LucyCarper

Latest Threads

Top