Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3306946
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:20:56+00:00 2026-05-17T21:20:56+00:00

I have an ASP.NET TextBox with TextMode = TextBoxMode.MultiLine that is used within an

  • 0

I have an ASP.NET TextBox with TextMode = TextBoxMode.MultiLine that is used within an AJAX Update Panel. The .Text value has been pre-set to a value that has multiple lines.

When using Chrome(7.0.517.41) or Firefox(3.6.11) working with the controls posted back value on the server the carriage return is lost if the user hasn’t edited the pre-set value.

E.g.
Initial .Text value set when the page loads:

“line 1/r/nline2/r/nline3”

Value of .Text on postback from Chrome or Firefox where the user has editied the textbox:

“line 1/r/nline2/r/nline3”

Value of .Text on postback from Chrome or Firefox where the user has not editied the textbox:

“line 1/nline2/nline3”

Why is the carriage return being lost and how can I resolve this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T21:20:56+00:00Added an answer on May 17, 2026 at 9:20 pm

    I’ve found a blog post by Craig Wardman Textbox CrLf in Firefox using AJAX UpdatePanel that discribes the same problem.

    When using a MultiLine textbox inside an ASP.NET AJAX update panel, you may encounter problems with carriage return line feeds in your text on the server using Firefox (and potentially other browsers).

    Internet Explorer uses the Windows style CrLf (13 10) for newlines in a textarea but Firefox uses Unix style Lf (10) only.

    On a synchronous postback it seems ASP.NET fixes this and you will get CrLf in your text on the server. However, when you are posting back asynchronously using AJAX, you only get Lf in your text when Firefox is used.

    His proposed solution is to resolve the issue server side:

    public static string CleanUnixCrLf(string textIn)
    {
       //firefox only uses Lf and not CrLf
       return System.Text.RegularExpressions.Regex.Replace(textIn, "([^\r])[\n]", "$1\r\n");
    }
    

    This will work, but I’d be interested in a solution that could fix the issue without having to check every posted back value.

    Edit

    This solution doesn’t handle multiple adjacent new lines.
    Appending .Replace("\n\n", "\n\r\n") to the other replace is one option.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have 2 asp.net textboxes in an update panel. Both textbox controls have some
I have an ASP.NET user control that contains a textbox which has an AJAX
I have asp.net TextBox with ontextchanged event this is search text box in my
I have an asp.net TextBox in which I want to check if the text
I have a asp.net web content from that have a asp.net textbox and I
the problem is that I do have an ASP.NET TextBox in a FormView with
I have an ASP.NET MVC Partial View that contains a Html.TextBox that is configured
I have a ASP.NET web page that contains many textboxes. Each textbox has a
I have the following asp.net markup: <asp:TextBox ID=txtPassword runat=server TextMode=Password ValidationGroup=passwordValidation></asp:TextBox> <asp:RequiredFieldValidator ID=RequiredFieldValidator1 runat=server
I have a asp.net textbox which contains some predefined text by default. when i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.