By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,630 Members | 1,166 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,630 IT Pros & Developers. It's quick & easy.

default button and enter

P: n/a
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
Nov 18 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Jos
Anton ml. Vaheie wrote:
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.

--

Jos Branders
Nov 18 '05 #2

P: n/a
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.

"Anton ml. Vaheie" <va*****@email.si> wrote in message news:<eU*************@tk2msftngp13.phx.gbl>...
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

Nov 18 '05 #3

P: n/a
Check out this article for how to do this,
http://www.allasp.net/enterkey.aspx

--
Saravana
Microsoft MVP - ASP.NET
www.extremeexperts.com

"Anton ml. Vaheie" <va*****@email.si> wrote in message
news:eU*************@tk2msftngp13.phx.gbl...
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

Nov 18 '05 #4

P: n/a
Thanks to all.

Anton
"Saravana [MVP]" <sa******@sct.co.in.nospam> wrote in message
news:eJ**************@TK2MSFTNGP11.phx.gbl...
Check out this article for how to do this,
http://www.allasp.net/enterkey.aspx

--
Saravana
Microsoft MVP - ASP.NET
www.extremeexperts.com

"Anton ml. Vaheie" <va*****@email.si> wrote in message
news:eU*************@tk2msftngp13.phx.gbl...
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


Nov 18 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.