473,480 Members | 1,750 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

textbox control question

djc
I noticed that after entering text into a textbox on an asp.net webform and
then hitting the enter key that a postback appears to be performed.

1) what event can I write to in order to perform an action at that time?
2) How can I prevent any postback from happening on textboxes that I do not
want to handle this event on?

any info is appreciated. Thanks.
Nov 18 '05 #1
7 1603
The postback occurs because you hit ENTER, it is not caused by the textbox.

If you had written code in the textbox's server event: TextChanged, then
that event would fire but the fact that you changed the text isn't what
caused the postback.

If you don't want to handle an event, simply don't write an event handler
for that event.

"djc" <no***@nowhere.com> wrote in message
news:ee**************@TK2MSFTNGP09.phx.gbl...
I noticed that after entering text into a textbox on an asp.net webform and
then hitting the enter key that a postback appears to be performed.

1) what event can I write to in order to perform an action at that time?
2) How can I prevent any postback from happening on textboxes that I do
not
want to handle this event on?

any info is appreciated. Thanks.

Nov 18 '05 #2
1. textchanged event

2. make autopostback property false.

Regards,

Rajesh Patel
"djc" <no***@nowhere.com> wrote in message
news:ee**************@TK2MSFTNGP09.phx.gbl...
I noticed that after entering text into a textbox on an asp.net webform and then hitting the enter key that a postback appears to be performed.

1) what event can I write to in order to perform an action at that time?
2) How can I prevent any postback from happening on textboxes that I do not want to handle this event on?

any info is appreciated. Thanks.

Nov 18 '05 #3
djc
Hi Scott, thanks for the reply.

I'm still a little confused on the behavior of hitting ENTER. 1) What event
fires when hitting ENTER when the focus is in a text box? 2) I have
autopostback set to false but a post back still occurs. Can I prevent this
postback from happening? Since nothing actually happens in my app the
postback may confuse the user.

thanks again.

"Scott M." <s-***@nospam.nospam> wrote in message
news:uI**************@TK2MSFTNGP09.phx.gbl...
The postback occurs because you hit ENTER, it is not caused by the textbox.
If you had written code in the textbox's server event: TextChanged, then
that event would fire but the fact that you changed the text isn't what
caused the postback.

If you don't want to handle an event, simply don't write an event handler
for that event.

"djc" <no***@nowhere.com> wrote in message
news:ee**************@TK2MSFTNGP09.phx.gbl...
I noticed that after entering text into a textbox on an asp.net webform and then hitting the enter key that a postback appears to be performed.

1) what event can I write to in order to perform an action at that time?
2) How can I prevent any postback from happening on textboxes that I do
not
want to handle this event on?

any info is appreciated. Thanks.


Nov 18 '05 #4
This is just the behavior of the browser. When a single line text box
(as opposed to a multiline text area) has focus and the user presses the
enter key the browser triggers the first submit button on the page. You
may be able to intercept the keystrokes for the page and "eat" the
keypress, or perhaps you could put an inocuous "bogus" button on the
page as the first button and disable it's ability to submit. Both of
these solutions would require javascript. I've never done this myself,
but I remember a team member creating an IE behavior to do the "eat",
but that only worked in IE (the company requirements allowed this).
Sorry I can't be more help.

Have A Better One!

John M Deal, MCP
Necessity Software

djc wrote:
Hi Scott, thanks for the reply.

I'm still a little confused on the behavior of hitting ENTER. 1) What event
fires when hitting ENTER when the focus is in a text box? 2) I have
autopostback set to false but a post back still occurs. Can I prevent this
postback from happening? Since nothing actually happens in my app the
postback may confuse the user.

thanks again.

"Scott M." <s-***@nospam.nospam> wrote in message
news:uI**************@TK2MSFTNGP09.phx.gbl...
The postback occurs because you hit ENTER, it is not caused by the


textbox.
If you had written code in the textbox's server event: TextChanged, then
that event would fire but the fact that you changed the text isn't what
caused the postback.

If you don't want to handle an event, simply don't write an event handler
for that event.

"djc" <no***@nowhere.com> wrote in message
news:ee**************@TK2MSFTNGP09.phx.gbl...
I noticed that after entering text into a textbox on an asp.net webform
and
then hitting the enter key that a postback appears to be performed.

1) what event can I write to in order to perform an action at that time?
2) How can I prevent any postback from happening on textboxes that I do
not
want to handle this event on?

any info is appreciated. Thanks.



Nov 18 '05 #5
Hitting the ENTER key is the same thing as pressing a submit button. This
is the default action of the browser, not any code you've written.
AutoPostBack has nothing to do with this since this action is happening in
the client.

If nothing happens in your app upon submitting, then what is the textbox
used for?

"djc" <no***@nowhere.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi Scott, thanks for the reply.

I'm still a little confused on the behavior of hitting ENTER. 1) What
event
fires when hitting ENTER when the focus is in a text box? 2) I have
autopostback set to false but a post back still occurs. Can I prevent this
postback from happening? Since nothing actually happens in my app the
postback may confuse the user.

thanks again.

"Scott M." <s-***@nospam.nospam> wrote in message
news:uI**************@TK2MSFTNGP09.phx.gbl...
The postback occurs because you hit ENTER, it is not caused by the

textbox.

If you had written code in the textbox's server event: TextChanged, then
that event would fire but the fact that you changed the text isn't what
caused the postback.

If you don't want to handle an event, simply don't write an event handler
for that event.

"djc" <no***@nowhere.com> wrote in message
news:ee**************@TK2MSFTNGP09.phx.gbl...
>I noticed that after entering text into a textbox on an asp.net webform and > then hitting the enter key that a postback appears to be performed.
>
> 1) what event can I write to in order to perform an action at that
> time?
> 2) How can I prevent any postback from happening on textboxes that I do
> not
> want to handle this event on?
>
> any info is appreciated. Thanks.
>
>



Nov 18 '05 #6
djc
got it. Thanks.

"John M Deal" <jo******@necessitysoftware.com> wrote in message
news:Oa**************@TK2MSFTNGP11.phx.gbl...
This is just the behavior of the browser. When a single line text box
(as opposed to a multiline text area) has focus and the user presses the
enter key the browser triggers the first submit button on the page. You
may be able to intercept the keystrokes for the page and "eat" the
keypress, or perhaps you could put an inocuous "bogus" button on the
page as the first button and disable it's ability to submit. Both of
these solutions would require javascript. I've never done this myself,
but I remember a team member creating an IE behavior to do the "eat",
but that only worked in IE (the company requirements allowed this).
Sorry I can't be more help.

Have A Better One!

John M Deal, MCP
Necessity Software

djc wrote:
Hi Scott, thanks for the reply.

I'm still a little confused on the behavior of hitting ENTER. 1) What event fires when hitting ENTER when the focus is in a text box? 2) I have
autopostback set to false but a post back still occurs. Can I prevent this postback from happening? Since nothing actually happens in my app the
postback may confuse the user.

thanks again.

"Scott M." <s-***@nospam.nospam> wrote in message
news:uI**************@TK2MSFTNGP09.phx.gbl...
The postback occurs because you hit ENTER, it is not caused by the


textbox.
If you had written code in the textbox's server event: TextChanged, thenthat event would fire but the fact that you changed the text isn't what
caused the postback.

If you don't want to handle an event, simply don't write an event handlerfor that event.

"djc" <no***@nowhere.com> wrote in message
news:ee**************@TK2MSFTNGP09.phx.gbl...

I noticed that after entering text into a textbox on an asp.net webform


and
then hitting the enter key that a postback appears to be performed.

1) what event can I write to in order to perform an action at that time?2) How can I prevent any postback from happening on textboxes that I do
not
want to handle this event on?

any info is appreciated. Thanks.


Nov 19 '05 #7
djc
I didn't realize it was actually the submit button that the browser fired
when hitting ENTER. This will work fine as it saves the user a click if they
hit enter. I did not have any code tied to the submit button yet and thought
the ENTER key hit was seperate. If that were true then I didn't want a user
to mistakenly think there info was submitted when they hit ENTER if it
wasn't.

thanks again.

"Scott M." <s-***@nospam.nospam> wrote in message
news:uL**************@TK2MSFTNGP10.phx.gbl...
Hitting the ENTER key is the same thing as pressing a submit button. This
is the default action of the browser, not any code you've written.
AutoPostBack has nothing to do with this since this action is happening in
the client.

If nothing happens in your app upon submitting, then what is the textbox
used for?

"djc" <no***@nowhere.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi Scott, thanks for the reply.

I'm still a little confused on the behavior of hitting ENTER. 1) What
event
fires when hitting ENTER when the focus is in a text box? 2) I have
autopostback set to false but a post back still occurs. Can I prevent this postback from happening? Since nothing actually happens in my app the
postback may confuse the user.

thanks again.

"Scott M." <s-***@nospam.nospam> wrote in message
news:uI**************@TK2MSFTNGP09.phx.gbl...
The postback occurs because you hit ENTER, it is not caused by the

textbox.

If you had written code in the textbox's server event: TextChanged, then that event would fire but the fact that you changed the text isn't what
caused the postback.

If you don't want to handle an event, simply don't write an event handler for that event.

"djc" <no***@nowhere.com> wrote in message
news:ee**************@TK2MSFTNGP09.phx.gbl...
>I noticed that after entering text into a textbox on an asp.net webform
and
> then hitting the enter key that a postback appears to be performed.
>
> 1) what event can I write to in order to perform an action at that
> time?
> 2) How can I prevent any postback from happening on textboxes that I

do > not
> want to handle this event on?
>
> any info is appreciated. Thanks.
>
>



Nov 19 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
8528
by: Karen | last post by:
I'm having trouble getting input from a textbox in Visual Basic 6.0 Private Sub cmdGetNumber_Click() txtInput.Text = Str(Int(1000 * Rnd)) End Sub The error message states: "Method or data...
2
8372
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when...
3
1686
by: Henry | last post by:
Hi. I've also posted this at another discussion board and here is the original question. ------------------------- "I have this problem and I don't know what I can do. First of all, I have a...
0
1371
by: jason | last post by:
Hello everyone. I am trying to write some custom command events into a DataGrid. The command that is currently giving me trouble is an "Add" custom command in the footer of a template column. ...
9
5588
by: D. Shane Fowlkes | last post by:
(ASP.NET 2 / VB) Question - How can I write a If statement to see if a control (textbox) actually exists on a page? Upon page_load, a certain control may or may not be visible on the page so I...
1
3191
by: rn5a | last post by:
I want to create a custom control that encapsulates a Button & a TextBox. When the Button is clicked, the user is asked a question using JavaScript confirm (which shows 2 buttons - 'OK' &...
10
2437
by: garyusenet | last post by:
I have a multiline textbox. The size of the text box should be 75 characters wide, and 5 lines in height like this: - <---75 characters--> <---75 characters--> <---75 characters--> <---75...
7
1579
by: Localbar | last post by:
Hi all, In my form have more then 10 textbox. I would like to make all textbox when lostfocus backcolor is white, when gotfocus backcolor is yellow. But I don't want to write same code in the...
3
2152
by: John Heitmuller. | last post by:
Hi, I just want to make sure I'm not missing something obvious. VB.Net controls like the CheckBox are implemented with a label attached to it. This is very handy. But the TextBox control has no...
6
3711
by: Tom P. | last post by:
I'm trying to make one of our perennial favorites - The Syntax Color Editor. (Mostly as a learning exercise). I'm wondering if there is a way to capture the Paint event of a textbox so I can...
0
7046
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6908
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7048
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7088
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
6956
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4485
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2997
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
2986
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1300
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.