This is a migrated thread and some comments may be shown as answers.

Assigning MultiLine value to RadTextBox.Text

4 Answers 536 Views
TextBox
This is a migrated thread and some comments may be shown as answers.
Jakkie Esschert van den
Top achievements
Rank 1
Jakkie Esschert van den asked on 06 May 2010, 04:26 PM

Hi,

I've got a RadTextBox which has multiline set to true. However, when I assign a value to the Text property which contain "\n" characters all text appears on a single line. Is the Text property supposed to handle multi line texts, or do I need to set some additional properties?

4 Answers, 1 is accepted

Sort by
0
Jakkie Esschert van den
Top achievements
Rank 1
answered on 10 May 2010, 10:23 AM

Well, I fixed it by manually splitting the string and assigning it to the lines property.

However, could it be that the TextBox doesn't handle "\n" but expects "\r\n" sequences?

0
Martin Vasilev
Telerik team
answered on 12 May 2010, 09:33 AM
Hello Jakkie Esschert van den,

Thank you for writing.

Actually, the described behavior is by design and if you want to set a multiline string to the Text property, you should use carriage return + new line sequence: "\r\n". Otherwise, you can use the Lines property. This functionality is exactly the same as the default one, which can be found in standard Microsoft TextBox control.

Let me know if you have any other questions.

Greetings,
Martin Vasilev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Mas
Top achievements
Rank 1
answered on 08 Jan 2019, 09:40 AM

Is it not weird that radtextbox control render newline correctly while I type directly from keyboard, but when I get the Text property, I get only \n instead of \r\n, and render the text in an expected ways ?

I use radtextbox control to get multi line word, user expect to use enter to separate word. I have set this control to allow multiline and accept return (and also accept tab). When I read Text property, I only get \n for new line, with out \r. 

As mentioned on other other thread, I may need \r\n to get this text shown back in correct way. The problem is, how to get \r\n from user input ?

 

 

0
Hristo
Telerik team
answered on 09 Jan 2019, 09:19 AM
Hi Mas,

Accessing the Text property of a RadTextBox which has a multiline text inputted by the end user will have \r\n in its value. As noted earlier in the thread, the behavior is the same as with the standard TextBox control. I am attaching a short video showing the result on my end as well as my test project. In case the issue persists please let me know how it can be reproduced.

Regards,
Hristo
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
TextBox
Asked by
Jakkie Esschert van den
Top achievements
Rank 1
Answers by
Jakkie Esschert van den
Top achievements
Rank 1
Martin Vasilev
Telerik team
Mas
Top achievements
Rank 1
Hristo
Telerik team
Share this question
or