473,977 Members | 14,815 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ENTER key in TextBox in ASP.NET 2.0

I add a TextBox with TextMode="Multi Line" so that I can input multilines to
the textbox. That's fine.

When user input <ENTERas a new line, it is ok during input to the textbox,
but not ok when the textbox content is saved to database (<ENTERcharacte r
seems to be ignored, no new line appears when the data is saved to
database).

Any hints.
Benson


Jul 9 '07 #1
4 3390
How do you know ? Newlines could be honored or not depending how you display
those data. In particular keep in mind that newlines are not significant
when using HTML i.e. you'll have to replace those with the br tag to see a
visible effect.

--
Patrice

"Benson Wong" <be****@linktec hsystem.com.hka écrit dans le message de
news: et************* *@TK2MSFTNGP03. phx.gbl...
>I add a TextBox with TextMode="Multi Line" so that I can input multilines to
the textbox. That's fine.

When user input <ENTERas a new line, it is ok during input to the
textbox, but not ok when the textbox content is saved to database (<ENTER>
character seems to be ignored, no new line appears when the data is saved
to database).

Any hints.
Benson


Jul 9 '07 #2
When you show the data on the page replace carriage returns with <br/>

myText.Replace ("\r\n", "<br/>");

"Benson Wong" <be****@linktec hsystem.com.hkw rote in message
news:et******** ******@TK2MSFTN GP03.phx.gbl...
>I add a TextBox with TextMode="Multi Line" so that I can input multilines to
the textbox. That's fine.

When user input <ENTERas a new line, it is ok during input to the
textbox, but not ok when the textbox content is saved to database (<ENTER>
character seems to be ignored, no new line appears when the data is saved
to database).

Any hints.
Benson



Jul 9 '07 #3
or, in VB:
myText.Replace( vbcrlf, "<br />")

--
David Wier
MVP/ASPInsider
http://aspnet101.com
http://iWritePro.com

"Benson Wong" <be****@linktec hsystem.com.hkw rote in message
news:et******** ******@TK2MSFTN GP03.phx.gbl...
>I add a TextBox with TextMode="Multi Line" so that I can input multilines to
the textbox. That's fine.

When user input <ENTERas a new line, it is ok during input to the
textbox, but not ok when the textbox content is saved to database (<ENTER>
character seems to be ignored, no new line appears when the data is saved
to database).

Any hints.
Benson


Jul 9 '07 #4
Work. Thanks.

"David Wier" <da*******@davi dwier.nospam.co m׫Œ‘ì¶à]¼þЄ:e5****** ********@TK2MSF TNGP05.phx.gbl. ..
or, in VB:
myText.Replace( vbcrlf, "<br />")

--
David Wier
MVP/ASPInsider
http://aspnet101.com
http://iWritePro.com

"Benson Wong" <be****@linktec hsystem.com.hkw rote in message
news:et******** ******@TK2MSFTN GP03.phx.gbl...
>>I add a TextBox with TextMode="Multi Line" so that I can input multilines
to the textbox. That's fine.

When user input <ENTERas a new line, it is ok during input to the
textbox, but not ok when the textbox content is saved to database
(<ENTERcharact er seems to be ignored, no new line appears when the data
is saved to database).

Any hints.
Benson



Jul 10 '07 #5

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

Similar topics

10
4431
by: Deano | last post by:
I think that just about sums it up. Is there a fix/workaround for this?It's quite annoying behaviour and not user-friendly.thanksMartin
7
38012
by: deko | last post by:
I have a textbox in a form into which users enter a string to execute a search. After the user presses Enter, I'd like the focus to go back to the textbox, but the default behavior of the Enter Key moves the focus to the next control. Here's the code: Private Sub txtFind_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then Call cmdFind_Click
5
6836
by: Steve | last post by:
Hi, Is it possible to make hitting the enter key in an ASP textbox run the code behind an ASP button on a form? I have a search page which users tend to type in the query then just hit enter rather than actually clicking the search button, but this does not run the search code behind the button.
5
1942
by: Girish | last post by:
I have TWO submit buttons of type IMAGE on my asp form. This renders as <input type="image">. I need to be able to eble the ENTER button for both buttons. Yes, I know that for the input type image, the submit happens automatically to the server. Heres my problem: I have two event handlers for both these buttons as stated below: BUTTON 1:
15
4076
by: Adam J. Schaff | last post by:
I have noticed that if a user closes a form via pressing return (either while the OK button has focus or if AcceptButton is set to OK for the form) then the "ENTER" keypress event fires ON THE CALLING FORM! This is very bad for me, because in my application, Form1 responds to an ENTER keypress by calling Form2. If the user closes Form2 via an ENTER, then Form1 just reopens it again, kind of trapping the user in Form2 (they can still close...
0
1833
by: Tom Edelbrok | last post by:
I'm using VS 2005 to develop an intranet asp.net web application and I get a weird situation. If I start out with any ASPX page that contains an ImageButton control followed by a TextBox control, everything works okay. I can press <ENTER> when the cursor is inside the text box and the page is running, and no events fire (this is what I expect). But as soon as I drop a second text box on the page (ie: after th first one) then pressing...
7
3185
by: Marc | last post by:
Hi, I want my user to be able to rename a button control by selcting rename from a menu. This then opens a text box in which to enter the new name in. I want the button control to inherit the name when the enter key is
4
7643
by: nkoier | last post by:
Hi, I've been going crazy trying to figure out what's wrong with our Asp.Net 2.0 intranet site. At the very top of our main page I provide a TextBox and a Button for submitting Google searches. Recently somebody pointed out to me that you can't just press ENTER anymore after typing in the TextBox but that you HAVE to click on the submit Button WITH THE MOUSE for it to work. After some initial troubleshooting I discovered that it's only...
1
7050
by: daonho | last post by:
I tried to use javascript to trigger up the button click function when user press enter key from the textbox. This function work fine with a single button click such has login page. However, if the page has multiple button such login page with a search function somewhere around, then it's not respond properly. I have attached a brief example of two text boxes and two button. When ever a key is press on textbox one, I want to trigger...
6
3601
by: Mark B | last post by:
I have a function that looks up a SQL table to see if a search term matches. It works fine but so far there are two things yet to work: 1) After entering a search term and pressing Enter, nothing has been happening. It has only been searching when I click the Search button. 2) Neither of the Response.Write's have been displaying any text. Here's the code:
0
10356
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
10172
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11823
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11413
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
10085
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...
0
7617
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6561
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4732
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3764
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.