473,587 Members | 2,412 Online
Bytes | Software Development & Data Engineering Community
+ 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 1619
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******** ******@TK2MSFTN GP09.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******** ******@TK2MSFTN GP09.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.nosp am> wrote in message
news:uI******** ******@TK2MSFTN GP09.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******** ******@TK2MSFTN GP09.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.nosp am> wrote in message
news:uI******** ******@TK2MSFTN GP09.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****** ********@TK2MSF TNGP09.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******** ********@TK2MSF TNGP11.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.nosp am> wrote in message
news:uI******** ******@TK2MSFTN GP09.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******** ******@TK2MSFTN GP09.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******@neces sitysoftware.co m> wrote in message
news:Oa******** ******@TK2MSFTN GP11.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.nosp am> wrote in message
news:uI******** ******@TK2MSFTN GP09.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****** ********@TK2MSF TNGP09.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.nosp am> wrote in message
news:uL******** ******@TK2MSFTN GP10.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******** ********@TK2MSF TNGP11.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.nosp am> wrote in message
news:uI******** ******@TK2MSFTN GP09.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******** ******@TK2MSFTN GP09.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
8533
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 member not found" The properties window of the textbox has "txtInput" next to "Name"
2
8379
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 submitting the form to update the database. The server doesn't have the client side value any more. It seems to me that as I begin to write the...
3
1697
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 page with and button, and 5 <asp:TextBox>'s and when an user makes changes to each of the textbox content, javascript client side code is...
0
1383
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. Question #1: In the Add button Command Event I am trying to access the Text value of the TextBox in the other Footer columns. However, inside the...
9
5613
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 need to first check to see if it actually exists and then if it does, get the value from it. If I try to read it or check if its "visible" if it's...
1
3204
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' & 'Cancel'). Till this point, no problem. Initially, the TextBox is empty. The Button has a property named 'ConfirmMessage' so that the developer using this...
10
2451
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 characters--> <---75 characters-->
7
1589
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 form. How to solve this problem. Is it can make a textbox class to control or some other method? Thanks
3
2161
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 implementation with a built-in attached label. You have to separately layout your TextBox and Label controls on a form. It's not a huge deal, but...
6
3729
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 render the text myself. I've tried to replicate the functionality of a textbox, but I think it would be easier to simply take over the painting of a...
0
7918
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7843
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8206
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8340
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8220
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5392
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3840
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3875
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2353
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 we have to send another system

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.