CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2000
    Location
    USA
    Posts
    179

    Press Enter in textbox

    Hi all!
    Please, help me
    I have button 'Save' and TextBox on my WebForm.
    When i press 'Enter' in my textbox i need to add a new line, and not press 'Save' button.
    What should i do?
    Thx in advance!

  2. #2
    Join Date
    Nov 1999
    Location
    Beijing, P.R.China
    Posts
    115

    Red face

    I think you can have two alternatives.

    1) Change the button Save to LinkButton.

    2) Add a piece of client script (javascript) to your TextBox for event onkeypress, check if the key code is 13, i.e. Enter is pressed, you make a call to the PostBack function.

    For detail, refer to Page.GetPostBackClientHyperlink().
    If it helps you, thanks for rating.

  3. #3
    Join Date
    Nov 1999
    Location
    Beijing, P.R.China
    Posts
    115
    Ohhhhhhhhhh.. sorry. After I clicked the sumit, I found I misunderstand your question.

    If you want a new line by pressing Enter, you should use multi-line TextBox, just change the TextMode property, you will get what you want.

    If it helps you, thanks for rating.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured