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

Wrong Button.OnClick() for TextBox

P: n/a
Hi!

I have an ASP.NET page with multiple TextBox fields and buttons. When I
press the <enter> key in a TextBox, the page postbacks, and one of the
buttons get fired (OnClick). Now certain TextBoxes trigger one particular
button on the page (this is the first button on the page, so probably that's
why that gets fired), while there is one TextBox, that seems to trigget
another one. I have no idea what's the difference between the TextBoxes, why
some fire this button and the others another..

Is there a way to specify which TextBox triggers which Button on the <enter>
keypress? I didn't find anything, like a default button for the form, or
something like that. But I would like to specify a default button on a per
control (that is, per TextBox) basis.

Thanks

Lenard Gunda
Nov 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Lenard Gunda a écrit :
Hi!

I have an ASP.NET page with multiple TextBox fields and buttons. When I
press the <enter> key in a TextBox, the page postbacks, and one of the
buttons get fired (OnClick). Now certain TextBoxes trigger one particular
button on the page (this is the first button on the page, so probably that's
why that gets fired), while there is one TextBox, that seems to trigget
another one. I have no idea what's the difference between the TextBoxes, why
some fire this button and the others another..

Is there a way to specify which TextBox triggers which Button on the <enter>
keypress? I didn't find anything, like a default button for the form, or
something like that. But I would like to specify a default button on a per
control (that is, per TextBox) basis.

Thanks

Lenard Gunda


You can use a specific control witch allows to specify the button on
thr action.
Go to http://www.metabuilders.com and use the DefaultButtons

Hope this help you

--
Ceci est une signature automatique de MesNews.
Site : http://mesnews.no-ip.com

Nov 18 '05 #2

P: n/a
use this Page.RegisterHiddenField("__EVENTTARGET",btnSearch .ClientID);

but it will fire for every text box that your cursor is in and you press
enter.

Av.

"Lenard Gunda" <fr****@fbi.hu> wrote in message
news:u$**************@TK2MSFTNGP12.phx.gbl...
Hi!

I have an ASP.NET page with multiple TextBox fields and buttons. When I
press the <enter> key in a TextBox, the page postbacks, and one of the
buttons get fired (OnClick). Now certain TextBoxes trigger one particular
button on the page (this is the first button on the page, so probably
that's
why that gets fired), while there is one TextBox, that seems to trigget
another one. I have no idea what's the difference between the TextBoxes,
why
some fire this button and the others another..

Is there a way to specify which TextBox triggers which Button on the
<enter>
keypress? I didn't find anything, like a default button for the form, or
something like that. But I would like to specify a default button on a per
control (that is, per TextBox) basis.

Thanks

Lenard Gunda

Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.