default button and enter

  • Thread starter Thread starter Anton ml. Vaheie
  • Start date Start date
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
 
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.
 
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.
 
Back
Top