469,644 Members | 1,696 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,644 developers. It's quick & easy.

default button and enter

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
4 1226
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
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
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
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.

Similar topics

1 post views Thread by Billy Jacobs | last post: by
2 posts views Thread by JP | last post: by
2 posts views Thread by Bratislav Jevtic | last post: by
4 posts views Thread by RA | last post: by
2 posts views Thread by jonefer | last post: by
1 post views Thread by andyrich_1 | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.