Multiline Textbox converts line feeds to BR HTML tags

2 posts, 0 answers
  1. Condorito
    Condorito avatar
    38 posts
    Member since:
    Mar 2009

    Posted 01 May 2012 Link to this post

    Hi,  I'm using Telerik web controls version 2012.1.215.35.  I have a RadTextBox with the TextMode property set to "MultiLine"  

    <telerik:RadTextBox runat="server" InputType="Text" ID="rtbSearch" Width="500px" TextMode="MultiLine"  Rows="5" EmptyMessage="Please enter numbers, maximum of 5, one per line."></telerik:RadTextBox>

    A button then calls some JavaScript code that retrieves the value of the RadTextBox using get_textBoxValue() and sends it over to a different page as a QueryString. I noticed however that it converts any line feeds like this:

    12345
    67892
    01234 

    to this:

    12345<br>67892<br>01234

    which causes an issue since the receiving page is expecting a line feed (Chr(10) + Chr(13)) and not HTML tags to separate the values.  How can I prevent this?  Thank you.
  2. jumpstart
    jumpstart avatar
    479 posts
    Member since:
    Nov 2011

    Posted 03 May 2012 Link to this post

    Juan:

    I'd suggest you reference this post for some insights on working with line breaks in JavaScript.

    You should be able to reformat your string using a regular expression, as follows, prior to feeding it to the QueryString:

    theString.replace( '<br />', /\n|\r/g )

    I hope this helps!
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top