simple problem with multiline textboxes in ASP.NET.....

  • Thread starter Antonio Lopez Arredondo
  • Start date
A

Antonio Lopez Arredondo

hi all again.....

I have an ASP.NET application that has a multiline textbox and a single
button.

the user should be able to write inside the many paragraphs in the multiline
textbox and then click the button to run the code behind.

the problem is that when the user presses the ENTER key to insert a new line
in the listbox, the button's code behind is executed.

is there any way to prevent this to happen ? I just want nothing to happen
when the ENTER key is pressed inside a multiline textbox.

thanks in advance,
ant
 
J

Jason MacKenzie

I resolved this problem using client side code.

In the onfocus event of the text box I called a method that sets a page
level javascript variable to true and the blur event sets it to false.

If window.event.keycode = 13 (enter key) I check for the value of that
variable before I decide what to do.

There may be an easier approach but this works great.
 
B

Bob Lehmann

Do you have a sample of this behavior?

My experience, when pressing the Enter Key, has been a new line in the
textarea - as expected.

Bob Lehmann
 
J

Jason MacKenzie

This was a while ago and I'm not sure of the specific set of circumstances
was. It was happening to me.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top