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 6236405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:50:56+00:00 2026-05-24T10:50:56+00:00

I have a TextArea where a user can write some text. When i try

  • 0

I have a TextArea where a user can write some text. When i try to show the text with LabelFor, i get an “illegal characters” error, because it the string has “\r\n” for every new line.

I’ve tried to use this solution:

Show new lines from text area in ASP.NET MVC

and

     if (q.help_text != null)
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            System.IO.StringReader sr = new System.IO.StringReader(q.help_text);

            string tmpS = null;
            do
            {
                tmpS = sr.ReadLine();
                if (tmpS != null)
                {
                    sb.Append(tmpS);
                    sb.Append("<br />");
                }
            } while (tmpS != null);
            var convertedString = sb.ToString();
            qvm.HelpText = convertedString;
        }
        else
            qvm.HelpText = q.help_text;

Instead of making new lines, LabelFor outputs the br code as well.
How can i solve this?

EDIT

The solution was to do it this way:

@Html.Raw(“

“+question.HelpText+”

  • 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-24T10:50:57+00:00Added an answer on May 24, 2026 at 10:50 am

    Use this syntax for LabelFor

    @Html.Raw(Html.LabelFor(x => x.Name))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a textarea where user can edit some text and it accepts HTML.
I have a textarea where the user can write up to 1000 characters. I
I'll get some info from an user using textarea. But he can not type
I have an app where a user can input text in a textarea. I
I have textarea in my site(link shortening site) i want to user enter some
I have a textarea on my page where i allow users to write text.
Here's my problem: I have a textarea where the user can enter whatever he
Assuming we have a comment textarea where the user can enter this code: [quote=comment-1]
I have a textarea where people can write comments and click a button to
I have a textarea in an ASP.NET MVC Application where the user can type

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.