473,666 Members | 2,039 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Postback after carriage return input

I have a WebForm with one control: A HTML INPUT control
with the property "runat=serv er" set. If this page is
running and I set the cursor in this control and
enter "Carriage return", the page does a roundtrip
(postback) to the server (which I doesn't want). If I
include a second HTML INPUT control on this page,
entering "Carriage return" does no postback.

How can I prevent a postback, if the user enters "CR"?

Thanks for an answer.

Ferdi
Nov 17 '05 #1
5 2180
"Ferdi" <fe**********@n ovacontrol.ch> wrote in message news:<0a******* *************** ******@phx.gbl> ...
I have a WebForm with one control: A HTML INPUT control
with the property "runat=serv er" set. If this page is
running and I set the cursor in this control and
enter "Carriage return", the page does a roundtrip
(postback) to the server (which I doesn't want). If I
include a second HTML INPUT control on this page,
entering "Carriage return" does no postback.

How can I prevent a postback, if the user enters "CR"?

Thanks for an answer.

Ferdi


You shouldn't stop this functionality, because it is common
functionality in web browsers, users expect this behavior.

You can however stop it by doing <input type="text" onkeydown="retu rn
event.keyCode== 13">
Nov 17 '05 #2
> You shouldn't stop this functionality, because it is common
functionality in web browsers, users expect this behavior.
It may be a common functionality in web browsers, but it can play havoc with
an ASP.Net WebForm. It is important to anticipate and handle this event.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Neither a follower nor a lender be.

"Giscard" <gi******@hotma il.com> wrote in message
news:3d******** *************** ***@posting.goo gle.com... "Ferdi" <fe**********@n ovacontrol.ch> wrote in message

news:<0a******* *************** ******@phx.gbl> ...
I have a WebForm with one control: A HTML INPUT control
with the property "runat=serv er" set. If this page is
running and I set the cursor in this control and
enter "Carriage return", the page does a roundtrip
(postback) to the server (which I doesn't want). If I
include a second HTML INPUT control on this page,
entering "Carriage return" does no postback.

How can I prevent a postback, if the user enters "CR"?

Thanks for an answer.

Ferdi


You shouldn't stop this functionality, because it is common
functionality in web browsers, users expect this behavior.

You can however stop it by doing <input type="text" onkeydown="retu rn
event.keyCode== 13">

Nov 17 '05 #3
-----Original Message-----
You shouldn't stop this functionality, because it is common
functionality in web browsers, users expect this behavior.

It may be a common functionality in web browsers, but it can play havoc withan ASP.Net WebForm. It is important to anticipate and handle this event.

In reality my WebForm needs, in addition to a few
listboxes and textboxes, several buttons to execute
different functions on the server. The return key will do
a click event on the first button (what ever the first
button is), but this is not what the user wanted to do.
The only solution to overcome this problem is to use HTML-
buttons instead of Server-buttons. Is there a better
solution for that problem?

Ferdi
--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Neither a follower nor a lender be.

"Giscard" <gi******@hotma il.com> wrote in message
news:3d******* *************** ****@posting.go ogle.com...
"Ferdi" <fe**********@n ovacontrol.ch> wrote in message

news:<0a****** *************** *******@phx.gbl >... > I have a WebForm with one control: A HTML INPUT control > with the property "runat=serv er" set. If this page is
> running and I set the cursor in this control and
> enter "Carriage return", the page does a roundtrip
> (postback) to the server (which I doesn't want). If I
> include a second HTML INPUT control on this page,
> entering "Carriage return" does no postback.
>
> How can I prevent a postback, if the user enters "CR"? >
> Thanks for an answer.
>
> Ferdi


You shouldn't stop this functionality, because it is

common functionality in web browsers, users expect this behavior.
You can however stop it by doing <input type="text" onkeydown="retu rn event.keyCode== 13">

.

Nov 17 '05 #4
Hi Ferdi,

Based on my research and experience, I do not think that there is a better
solution.

Best regards,

Jacob Yang
Microsoft Online Partner Support
<MCSD>
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 17 '05 #5
Hi Ferdi,

I have another simple idea for your reference. That is disable the
onkeydown event of this button. The following is the code snippet:

<INPUT id="Button2" style="Z-INDEX: 102; LEFT: 248px; WIDTH: 88px;
POSITION: absolute; TOP: 96px; HEIGHT: 24px"
type="button" value="HTML Control" name="Button2" runat="server"
onkeydown="retu rn false"></FONT>

Does it answer your question? If I have misunderstood your concern, please
let me know.

Best regards,

Jacob Yang
Microsoft Online Partner Support
<MCSD>
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 17 '05 #6

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

Similar topics

1
13034
by: yawnmoth | last post by:
so... i'm trying to remove all carriage returns in the input i get from GET, and am trying to replace them with three dots... however, this never seems to work... i'm still getting carriage returns... here's my script... any ideas as to what's wrong?: <?php
4
9873
by: Dr. Laurence Leff | last post by:
I am writing a Java program to read in XML file, modify some elements slightly, and then write it out. That XML file is prepared in Docbook. It works fine, except that it is disturbing the carriage returns in places where they have meaning. Attached are a sample input file, the sample output file, and a simplified version of my Java program. My real file, examines certain element's attributes and adds certain elements to the DOM...
3
2454
by: Charles Gamble | last post by:
Hi, I am performing a post from one classic ASP page to another in order to get the value of a string passed between the two pages. I have a client script variable declared to take the value of the value being received in the page i.e. var x = '<%=varName%>'. Unfortunately, ASP seems to be adding a carriage return to the value of varName when it is passed in i.e. it expands the stated line to var x = 'FieldContents ';. I.e. somewhere a...
12
5609
by: Nimmy | last post by:
Hi, I have a data file and I want to remove Carriage returns. Any one has any C code/program which does this? I am working on Windows XP machine.....I don't have access to UNIX machine. But I need to send this data file to the Unix machine once I remove the carriage retunrns from my XP machine. Thanks
6
17588
by: Laura D | last post by:
How can I identify a carriage return in C++? \r, \f, \0, \n, \t does not work. I have also tried !isprint(ch), iscntrl(ch), isspace(ch), etc....with no luck! I even poked around in the MSDN and found some code that MS claims will save a file in unix format and I cut and pasted into my program(and made changes to suit): ..... char ch; char temp="\0"; //Open the file for reading in binarymode. ifstream fp_read(filename.c_str(),...
1
2211
by: Steve | last post by:
I have a simple form with a textbox and a command button, both web form controls (not raw HTML controls). I notice that when the user enters text in the textbox and hits carriage return, the form posts back. Is there a way to prevent this? I think it is undesirable for two reasons 1) Developer must support re-rendering the page even if no events fire, which is another path through the code to worry about (not always trivial if...
2
2638
by: Alex | last post by:
In my Asp.net application, I have come across a situation where I cannot prevent a postback using the HtmlInputImage control. If I use the HtmlInputButton, the post back is not automatic, however with the HtmlInputImage, it appears to be. Add this to your aspx test app and set a breakpoint in your Page_Load. <input type="button" id="TheButton" value="GO"/> <input type="image" id="TheImage"/> When you click on the "TheButton" - no...
1
6259
by: Blue | last post by:
This JS limits the input characters into the form. How do I modify it so that it also allows CARRIAGE RETURN and BACKSPACE (for making text correction)? Due to the template engine I am using, I cannot use IF/ELSE statement. ============================== <form> <textarea name="event_description" ONKEYPRESS="if (document.layers)
2
3948
by: polohero | last post by:
I am using an FtpClient.cs that someone else created and when I'm uploading (it uses a Socket) a file a carriage return is getting deleted when the file appears on the ftp location. Normally this wouldn't be a huge issue but this file is encrypted and by losing this byte it's unable to decrypt successfully. Example of section where it errors out from original file (just file bytes): E6C5C22DB57E0D0A78E5936259DCF4D8 Example of section...
0
8444
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8781
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8639
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7386
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6198
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4198
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4368
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1775
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.